Manager icon indicating copy to clipboard operation
Manager copied to clipboard

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

Open spartyboy opened this issue 3 years ago • 5 comments

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 }

spartyboy avatar Nov 16 '22 05:11 spartyboy

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.

RaulG23-pixel avatar Dec 23 '22 21:12 RaulG23-pixel

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

sergey-derevjanko avatar Mar 17 '23 17:03 sergey-derevjanko

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.

stale[bot] avatar May 22 '23 01:05 stale[bot]

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)

aman-digtl avatar Jun 26 '23 07:06 aman-digtl

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.

stale[bot] avatar Sep 17 '23 10:09 stale[bot]