I am trying to use the Laravel Socialite package on top of the api. I try to pass the code to my api to get the user, but it keeps giving me an error:
Fatal error: Call to a member function pull() on null
Since I am executing an API request, I am doing the following steps.
Send api request for url to retrieve code:
Socialite::with('facebook')->stateless()->redirect()->getTargetUrl()
Then run the query with the above URL, which is redirected with the code parameter.
Send the code to api and select the user:
$fb_user = Socialite::with('facebook')->user();
Here it is crashing. I do not know why.
I have used the package before and it works great when I just have an application that reloads the page. But when I send it to api (in another domain), it crashes. I think there is some problem with how the code is generated. Is there any way to fix this?
php laravel laravel-socialite
Rob
source share