@silva wrote:
I'm trying to implement authentication after the user creation in an ember/rails-api
I'm able to correctly add the user to the database, but I'm getting this in the console:ember.debug.js:31321 Error: Assertion Failed: Encountered a resource object with an undefined type (resolved resource using ember-app@serializer:user:)
I do get back the correct json with my info:
{"data":{"token":"ezUR_NTxy7STEiiFhEx3","email":"test@email.com"}}
when I run in the console:
newUser.save()
Class {__ember1473012953664: "ember539", __ember_meta__: Meta} __ember1473012953664: "ember539" __ember_meta__: Meta __proto__: Class __ember1473012953664: "ember113" __ember_meta__: Meta _super: ROOT() catch: () constructor: (subclass of Ember.ObjectProxy) content: (...) finally: () isFulfilled: false isPending: ComputedProperty isRejected: false isSettled: ComputedProperty promise: ComputedProperty reason: null then: () __proto__: Class
isFulfilled is false... so the authenticate method is not even called:
newUser.save().then(function(response) { this.get('session').authenticate('authenticator:devise', newUser.get('email'), newUser.get('password')).catch((reason) => { this.set('errorMessage', reason.error); }); });
Any chance someone could give me a hand??
Thanks in advance!!
Posts: 1
Participants: 1