Ember App does not send sessionId back to server

I have an Ember app which retrieves data from an express App via Rest-Calls. After a successfull Login the Server creates a Session an put some data into it. On each subsequent Rest call of the Ember App the Session on the Server is newley created. When I execute the same Request by using Postman everythin works fine and the session remains the same.

Any idea on how to solve this issue ?

Have you configured your fetch requests to include credentials? If not, this sounds like expected behavior as the browser will not include cookies.

Are you using an authentication library like ember-simple-auth? If not I would consider setting up ESA, otherwise you’ll be hand-rolling some of the functionality.

Yes I am using ember-simple-auth

How can I configure Emser in Order to set this property ?

So there are some specifics that we would need to know to be able to help you. It’s great that you’re using ember-simpole-auth, that’s quite useful for having a session available with your auth credentials wherever you are making requests but we need to make sure that you are sending your credentials with every request.

How do do you actually do your REST calls? are you using ember-data? are you using fetch? do you have a service that you use that handles your fetch calls for you?

We are using ember-data in order to get data from our backend. When the user logs in the server does the authentication and sends a jwt token back

if the jwt token is not returned as a session token you’ll have to manually include it in the headers of the request. When using ember-data, if using newer patterns (e.g. RequestManager) you’d set this up in a handler, if using older patterns (e.g. adapters/serializers) you’d set this up in your adapter.

Thanks for your help. I have finally made it. the Problem was missing Headers from Server.

2 Likes