Next.js Discord

Discord Forum

Implement AccessToken and Refresh token

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
HI, i want to use access and referesh token in next 13.4/13.5 version. what is the best approach to achieve this ? axios or Fetch Api. using middlerware for this or like axios interceptor ?

1 Reply

I haven't done it with Next, but i guess I would implement the logic in middleware : you can access requests and cookies. Or through a wrapper or a HOC. depends on you needs...
I used middleware for cathing routes and it's really good and easy to implement.