Hi, I have a nextjs application that calls an API ...
# support-questions-legacy
m
Hi, I have a nextjs application that calls an API (a nodejs server) for its data. The api implements the server-side supertokens SDK. With nextjs it is possible to fetch data and render the contents of a page at request time [1]. If I try to fetch data from the api that requires authentication, it will fail because the api will not have received the access token cookie. A solution could be to take the cookie that is sent to the nextjs server and send it along to the api. However, I'm not sure if this is the correct approach: I would then also need to implement logic dealing with refreshing access tokens (using the refresh token), all of which would probably just work out of the box when using the client side SDK. Is there a recommended way to call authenticated endpoints from the backend (i.e. server to server) using user credentials? [1]: https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props