larapi
larapi copied to clipboard
can't get acess token in LoginProxy
Hello,
it's not Larapi issue I used some part of your configuration to mount my backend API for SPA React UI, I focused on authentication (login logout) part, everything works fine for authentication (I get the token and user can refresh to get new one).
but when i try de Logout i get FatalThrowableError when trying to get user access token in LoginProxy
Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function token() on null in file LoginProxy
I did not make any changes to LoginProxy, maybe I missed something from my project setup, can you give me a track of the possible cause of this issue.
@aityahiaidir did you update cloned source code with pull requests?
https://github.com/esbenp/larapi/pulls
@MahdiPishguy no i didn't done, which code, my one code ?
@aityahiaidir check pull requests and apply them on your local project, it seems this problem can be fine
@aityahiaidir It seems I have the same issue. Did you solve this? After successful access token generation the user is not logged in and the auth()->user() returns null.
@nteath I have the same problem too. The way I fixed it is using middleware auth:ap
for the logout route. My code is Route::post('auth/logout', 'LoginController@logout')->middleware('auth:api');
Also from the client, you have send a post request that has Authorization Bearer token. This way the authmanager can use the included access token in your request to retrieve the correct user