Replies: 1 comment 3 replies
-
having same problem and tried many days to configure axios and next-auth to work in both server and client component. but no result |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hello everyone!
I encountered an issue during the development of my pet project. I am using the Next-Auth Credentials Provider for my backend and Axios to manage API calls. To avoid passing the access token in the headers.Authorization every time, I created an Axios instance that looks like this:
I'm not sure how correct it is to use this code (there might be room for improvement), but it works for me. However, I cannot use this instance in SSR because it relies on getSession internally. Are there any ways to make this instance available both on the server and client or is the only solution to pass the token on the server and use the instance on the client (where there are more requests to private routes)?
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions