larapi icon indicating copy to clipboard operation
larapi copied to clipboard

can't get acess token in LoginProxy

Open aityahiaidir opened this issue 6 years ago • 5 comments

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 avatar Nov 29 '17 12:11 aityahiaidir

@aityahiaidir did you update cloned source code with pull requests?

https://github.com/esbenp/larapi/pulls

pishguy avatar Dec 05 '17 21:12 pishguy

@MahdiPishguy no i didn't done, which code, my one code ?

aityahiaidir avatar Dec 06 '17 17:12 aityahiaidir

@aityahiaidir check pull requests and apply them on your local project, it seems this problem can be fine

pishguy avatar Dec 06 '17 18:12 pishguy

@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 avatar Apr 26 '19 12:04 nteath

@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

locto03 avatar Sep 24 '19 01:09 locto03