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

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

Jeffrey Codes

4 года назад

9,244 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@semen083
@semen083 - 21.04.2020 11:45

Hi, how you handle wrong password input of user in local strategy? In my case with proper credentials all work fine, but if user input wrong password or userName, i send from backend response with error description("Wrong password","Wrong userName" and I wont show this text to user), but i can't read it in "catch" section of "loginWith" function cause right after logIn request the auth-module again send request to "user" endpoint and it rejected(cause on backend "user" endpoint only for authorized users). Thanks

Ответить
@tnederlof
@tnederlof - 28.04.2020 01:29

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

Ответить
@desarrollofacil411
@desarrollofacil411 - 30.06.2020 07:17

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

Ответить
@rolenok7088
@rolenok7088 - 01.07.2020 11:05

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

Ответить
@rolenok7088
@rolenok7088 - 01.07.2020 11:08

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

Ответить
@ecofriend93
@ecofriend93 - 10.07.2020 16:35

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

Ответить
@wellingtoncapoia
@wellingtoncapoia - 13.09.2020 02:08

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.

Ответить
@braintricker_soft
@braintricker_soft - 22.12.2020 08:58

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

Ответить
@maba99
@maba99 - 14.07.2023 12:48

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

Ответить
@tushar3453
@tushar3453 - 20.05.2024 16:14

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

Ответить