A
A
Alexander Pankov2022-02-11 11:40:33
User identification
Alexander Pankov, 2022-02-11 11:40:33

How to authenticate on nuxt?

Hello, not so long ago I asked about the nuxt auth system,
advise throwing out the nuxt / auth module,
well, otherwise I can’t figure it out completely

, but I also can’t google how to do it myself, can you tell me the steps?
0) I go to the client login page
1) I make a request for auth (log in)
2) I get jwt \ refresh \ client data in response
3) I save all tokens in httponly cookies
4) I save the user in the store whether)?
5) then I write interceptors for axios, so that the tokens themselves are updated if the access is rotten and the header with jwt is set itself
6) in nuxtServerInit I write a method that "before the browser" will cancel the request with cookies and tell me the current user and I will install it (this is so that when the browser page is reloaded, the authorization does not crash)

is that right?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question