Closed MarkMT closed 8 years ago
Update: It seems that ActiveModelSerializers was the culprit here. The solution was to override the devise SessionsController#create action and render raw json instead of the user resource
render :json => {:email => current_person.email, :authentication_token => current_person.authentication_token}
Hello @MarkMT,
You were faster than me, yes you have to include the authentication_token
in your API response if you want to use it. I guess including it in your PersonSerializer
wouldn't be a good idea, but I wonder if it is possible to append it in the context of the sign in action (?) maybe not.
I would be interested in your experience using the gem with Ember, if you want to put a short example in a gist or something alike, I would be glad to put a link in the wiki : )
Sure, I'm on a tight schedule atm, but when I get done with this project I'll try to put something together.
I think I can close this, right? Don't hesitate to re-open it if not.
Thanks, all good.
I'm trying to use s_t_a with ember_simple_auth and Rails 5 api + devise. If I login with incorrect credentials I get a json response
{"error":"Invalid email or password."}
as expected. However if I submit correct credentials I get a 200 response from the server, but the response is empty.Following this comment I've added
to my ApplicationController.
Because my front end is Ember, I'm also using ActiveModelSerializer's json_api adapter. When I log in (in development mode) I see this in my server console -
yet I still see nothing in the body of the response received by the browser.
As suggested in this comment I've also tried overriding
Devise::SessionsController#create
to render json directly - this seems to bypass the AMS serialization, but again there's no content in the response received by the browser.Any advice would be greatly appreciated.