N
N
Nikita Reshetnyak2019-07-04 05:53:34
Node.js
Nikita Reshetnyak, 2019-07-04 05:53:34

How to implement ExpressJS cross-domain authorization?

Hello, the task arose to make a cross-domain authorization system. There is a NodeJS&ExpressJS server sitting on the api.server.com domain and a client written so far using ExpressJS&EJS sits on the webclient.com domain. The client sends the data to the server where the validation takes place and, if successful express-session, a cookie is created with the help. As far as I understand, the client receives it, but I don’t know how to dance from it. It is required, depending on the cookie, to change the line by type Привет, {UserName}, and do the same with the profile, when you click on the link, a request is sent to the server, from where the data is already loaded and the profile of a particular person is shown.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Skibin, 2019-07-04
@MeG1tsune

Use CORS if you have authorization on your other service and use a single session storage for two servers
https://expressjs.com/en/resources/middleware/cors.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question