0
votes

I have an Ember CLI front-end app, and a Rails app using Devise for authentication. I thought I had things set up correctly, but I am running into a few problems.

1) After submitting the login form, I do not get re-directed. If I manually click a link that is behind authentication, it sees I'm authenticated.

2) After reloading the page, the session info in local storage doesn't persist.

Any ideas?

Thanks in advance

2

2 Answers

0
votes

1) it by defaults redirect to index route after login, stick a debugger in the beforeModel hook of the index route and verify this

2) something like this in your config/environment.js, but since your using the devise plugin and not your own custom authorizer not 100% sure

ENV['simple-auth'] = {
  localStorageKey: 'my-app-session',
  store: 'simple-auth-session-store:local-storage',
  authorizer: 'authorizer:devise'
};

it's sort of vague questions though, need more code and info if your using tokens or cookies, etc?

0
votes

Ahhh I figured it out. It looks like because I am using activemodel serializers in my rails app, it was including the root(in this case sessions: because the response was being served from sessions controller). I told it to not use ActiveModel Serializers, render json: data, status: 201, serializer: nil That did the trick! I'm guessing AMS and custom resource names do not play well together.