Nuxt Auth: Why does loginWith call both ‘login' and ‘user' API endpoints? (Source dive)

preview_player
Показать описание

To answer this question, we're going to be doing a source dive into the Nuxt Auth codebase.

We'll also talk about options for what you can do if you need to work with a suboptimal API.

Рекомендации по теме
Комментарии
Автор

This was really helpful. Now I see the value in making the request twice!

tnederlof
Автор

I still don't understand, after logging in successfully, receiving the token he calls a route from api / users, how is this identifying the user he has to search for? just by the token? so I have to have an endpoint that searches for the user from the token?
Because at least here, when requesting users he doesn't send any data other than the token.

wellingtoncapoia
Автор

I think lot of people is confusing since they are using JWT and the user info is already in the token so a second call is just not needed, a work around is to replace the fetchUser function for a function to extract the user details from the token and then set the user with those details

desarrollofacil
Автор

hi, nice video. please create a video with different domain between frontend login and backend api, i have cors and csrf issue using laravel sanctum and nuxt 2

maba
Автор

another question in auth config I disable the local storage and active cookie to not save user info in localstorage but also still save auth user info in local storage

rolenok
Автор

when i call login endpoint then its only call login endpoint but not calling user please any one have solution

tushar
Автор

i am trying to login with laravel passport data successfully returning from back end but login is not working in front end

braintricker_soft
Автор

Hi, when the password of user wrong and the api send response with error message why auth still act as the loginin success ?

rolenok
Автор

Thanks, for this tutorial! Would love a tutorial on creating custom schemes for authentication.

ecofriend