diff --git a/Provider.php b/Provider.php index 7b5c478..ff4b9f4 100644 --- a/Provider.php +++ b/Provider.php @@ -103,7 +103,7 @@ protected function getUserByToken($token) 'Authorization' => 'Bearer '.$token, ], RequestOptions::QUERY => [ - 'fields' => 'open_id,union_id,display_name,avatar_large_url', + 'fields' => 'open_id,union_id,display_name,avatar_large_url,username', ], ]); @@ -119,6 +119,7 @@ protected function mapUserToObject($user) return (new User())->setRaw($user)->map([ 'id' => $user['open_id'], + 'nickname' => $user['username'] ?? null, 'union_id' => $user['union_id'] ?? null, 'name' => $user['display_name'], 'avatar' => $user['avatar_large_url'], diff --git a/README.md b/README.md index 7b65cf8..14ed512 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ return Socialite::driver('tiktok')->redirect(); # Returned User Fields - id +- username - union_id - name - avatar