Open spartyboy opened 2 years ago
I got the same error and I didn't even make something weird with the code I just called the method
Socialite::driver("twitter")->user()
to retrieve user data and the code returns this exception:
[Indirect modification of overloaded property SocialiteProviders\Manager\OAuth1\User::$urls has no effect]
this is my code:
<?php
namespace App\Http\Controllers\OAuth;
use Illuminate\Http\Request;
use Laravel\Socialite\Facades\Socialite;
class TwitterOAuthController
{
public function redirect(){
return Socialite::driver("twitter")->redirect();
}
public function callback(Request $request){
$user = Socialite::driver("twitter")->user();
}
}
The redirect method works perfectly but the driver is unable to get the user information when I use the method user() on the callback function.
I got the same error
For me helped this:
in userDetails() use
$user = new \League\OAuth1\Client\Server\User();
instead
SocialiteProviders\Manager\OAuth1\User
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
same here:
SocialiteProviders\Manager\OAuth1\Server::getTokenCredentials(): Argument #1 ($temporaryCredentials) must be of type League\OAuth1\Client\Credentials\TemporaryCredentials, bool given, called in /var/www/backend/vendor/socialiteproviders/manager/src/OAuth1/AbstractProvider.php on line 177 {"exception":"[object] (TypeError(code: 0): SocialiteProviders\\Manager\\OAuth1\\Server::getTokenCredentials(): Argument #1 ($temporaryCredentials) must be of type League\\OAuth1\\Client\\Credentials\\TemporaryCredentials, bool given, called in /var/www/backend/vendor/socialiteproviders/manager/src/OAuth1/AbstractProvider.php on line 177 at /var/www/backend/vendor/socialiteproviders/manager/src/OAuth1/Server.php:49)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Twitter return Indirect modification of overloaded property SocialiteProviders\Manager\OAuth1\User::$urls has no effect on callback page when am trying to get the user from socialite
The issue is from this part of the package from telescope
$used = ['id', 'screen_name', 'name', 'location', 'description', 'profile_image_url_https', 'email'];
63
64 foreach ($data as $key => $value) {
65 if (strpos($key, 'url') !== false) {
66 if (!in_array($key, $used, true)) {
67 $used[] = $key;
68 }
69
70 $user->urls[$key] = $value;
71 }
72 }
73
74 $user->extra = array_diff_key($data, array_flip($used));
75
76 return $user;
77 }