Issue authenticating user session using ember-simple-auth

I am trying to authenticate a user session after he/she log in. I call the following in my route to do this:

this.get('session').authenticate(authenticator, user.email, user.password).catch((reason) => {
  this.set('errorMessage', reason.error || reason);
});

Which throws the error:

assert.js:36 Mirage: Your Ember app tried to POST '/users/sign_in',
but there was no route defined to handle this request. Define a route 
that matches this path in your mirage/config.js file. Did you forget 
to add your namespace?

I allow all requests to localhost:3000/api/v1 to passthrough so mirage isn’t an issue with most requests.

However, I am not sure where my app is making this POST request to. Is it localhost:4200?

Does my server need to have a /users/sign_in endpoint? And if so, does it need to handle this request somehow? I feel like that should be built in to ember-simple-auth since that’s kind of the point of using a 3rd party for this sort of thing.

Yes, from my understamding you need this endpoint or you configure your authenticator in /authenticator/my-authenticator.js to point to an existing endpoint.

But I’m not sure if this is correct as i’m having trouble my self with the csrf token atm

Using simple auth token you can define a specific end point in the environment config:

ENV['ember-simple-auth-token'].serverTokenEndpoint = ...

I can’t find something simular in the simple auth docs though.

From the simple auth docs:

So what do I do with this endpoint? It doesn’t tell me what it expects the server to respond with at all

If you are using ember-simple-auth then the default serverTokenEndpoint is ‘/users/sign_in’, however if you want to use some other end point, you might have to roll down your own custom authenticator.

Or you can use ember-simple-auth-token as Bauke mentioned, and set the end point as: serverTokenEndpoint: 'http://localhost:3000/api/v1/your-custom-url/'

In both the cases the server is supposed to create a session and return either the session data or a token containing the session data with a success status code.