refresh token rotation on app router with next 15
Unanswered
Japanese Bobtail posted this in #help-forum
Japanese BobtailOP
i want to create refresh token rotation structure on middleware but i think not possible to catch api response 401 code on middleware what is the best way to refresh token rotation without using 3rd party library
6 Replies
Japanese BobtailOP
so you mean make api call for check is valid or not ? but when i make this request on middleware this request trigger every render or change routes exc. and i think this is bad for BE optimization
@Japanese Bobtail so you mean make api call for check is valid or not ? but when i make this request on middleware this request trigger every render or change routes exc. and i think this is bad for BE optimization
American Chinchilla
Oh i mean have a seperate api backend route
If we are talking about jwt here
Check if token is invalid in middleware then call the api refresh route from client side
Or jusr validate and refresh if expired together in the middleware