I’m having a tough time understanding how to set this up with a basic express server using passport to handle the server side authentication. Can anyone point me in a direction of getting this to work?
So far I have my express server using
passport-local to handle the authentication when the user attempts to login, it then sends back a JWT generated from the
jsonwebtoken npm package and hands that back to ember. I’m using
ember-simple-auth-token to handle this on the ember side. So far in ember I have my routes locked down and forwarding to a login page. The login page has a form that submits to my
/auth endpoint and receives the token and a
200 from the
/auth endpoint, but when I refresh on the ember side I have to login again, like it’s not saving the session. And when I try to access my other API end points that have the
passport-jwt module as a middleware they won’t authenticate, and inspecting what ember is sending to the endpoints there is no authorization header with the token being sent to the other endpoints.
I have the
ember-simple-auth-store:local-storage set in the environment variables and the expiration coming from the JWT is set to 5 minutes.
I could really use some expertise here on how to get this working. I’ve seen some tutorials on using sails.js or some other
ember-simple-auth authenticators but I really want to use a simple express server with the JWT strategy. Unless you could persuade me otherwise.