I have a Laravel web app set up with Auth0 integration, using the
laravel-auth0 library. I followed the Quick Start to get a basic login flow working.
Now, however, I need my Laravel app to talk to a back-end API which is also secured with Auth0. I don’t see how to retrieve an access token to use for this. The
Auth0Service does expose a
getAccessToken() method, but it always returns
I stepped through the code and found that the
Auth0::exchange() method is being called, but there is no authorization code, so no exchange takes place.
My login code:
return \App::make('auth0') ->login(null, null, ['scope' => 'openid profile email name nickname picture updated_at customer:edit customer:read'], 'code');
The last 2 scopes are for the API I am trying to call. I also have an
AUTH0_AUDIENCE entry in my
I also set the options to persist the tokens to true in the
laravel-auth0.php config file:
'persist_access_token' => true, 'persist_id_token' => true,
Can anyone tell me what I might have missed? Or if I need to get direct access to the underlying SDK objects, what is the cleanest way to go about doing that? Thanks in advance.