D
D
djEban2021-09-29 05:29:40
JavaScript
djEban, 2021-09-29 05:29:40

How to make a server side cross domain request in next.js?

Hello.
I have an endpoint located on a different domain. From the locale, I want to make a request for the user to perform server authorization using getServerSideProps.
Of course, using native fetch and setting "credentials: 'include'", I don't get the desired result, but only "credentials were not provided". This is understandable, because everything is done on the server, and these settings are browser-based.
I can get cookies via request.headers.cookie (authorization, if anything, by session). But how do I make them go to another server is a mystery.
What to do? Or am I misunderstanding something? And what I want is unrealistic, and you need to write the session processing logic in the next itself.

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