Using Laravel Socialite with an API? : <p>I'm trying to use Laravel Socialite package over an api. I try to pass the code into my api to fetch the user but it keeps giving me an error:</p>

<pre><code>Fatal error: Call to a member function pull() on null
</code></pre>

<p>Since I'm doing the request over an API, I take the following steps.</p>

<p>Send a request to api for the url to fetch the code:</p>

<pre><code>Socialite::with('facebook')-&gt;stateless()-&gt;redirect()-&gt;getTargetUrl()
</code></pre>

<p>Then make a request with the above fetched url, which redirects with the <code>code</code> parameter.</p>

<p>Send the code to the api and fetch the user:</p>

<pre><code>$fb_user = Socialite::with('facebook')-&gt;user();
</code></pre>

<p>This is where it crashes. I'm not sure why. </p>

<p>I've used the package before and it works fine when I just have an app that reloads the page. But when I send it to an api (on a different domain) it crashes. I'm thinking there is some issue with how the code is generated. Is there anyway to fix this?</p>
