SocialiteProviders / Manager

Easily add new or override built-in Laravel Socialite providers
https://socialiteproviders.com/contribute/
MIT License
392 stars 84 forks source link

I get this on Twitter call back and I don't know why #213

Open spartyboy opened 2 years ago

spartyboy commented 2 years ago

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 }

RaulG23-pixel commented 1 year 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.

sergey-derevjanko commented 1 year ago

I got the same error For me helped this: in userDetails() use $user = new \League\OAuth1\Client\Server\User(); instead SocialiteProviders\Manager\OAuth1\User

stale[bot] commented 1 year ago

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.

aman-digtl commented 1 year ago

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)

stale[bot] commented 1 year ago

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.