L
L
Lehahabl2022-02-10 17:24:41
JavaScript
Lehahabl, 2022-02-10 17:24:41

How to implement updating access and refresh tokens in next js?

We have an external API that provides authorization logic

when /api/login is called , we get and also refresh_token comes as an HttpOnly cookie access_token lives for 15 minutes, after this time, we send a request to /api/refresh , we get a new pair Implementation of updating access_token with CSR is clear , the question is how to make the access_token update logic in NextJS at the moment getServerSideProps ? Those. the request went to gsp, fell from 401, we update the tokens, how to send a new pair to the client? {access_token: '', refresh_token: ''},

{access_token: '', refresh_token: ''},



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