ember-simple-auth
ember-simple-auth copied to clipboard
resourceName is mandatory for devise authenticator
I'm trying to user devise authenticator from ember-simple-auth together with devise-token-auth. The problem is that ember-simple-auth sends the data during sign_in namespaced according to set resourceName (default is user). So the request body looks for example like:
{ user: { email: 'xxx', password: 'yyy' } }
This is a problem because devise-token-auth expects the data in a flat format. i.e:
{ email: 'xxx', password: 'yyy' }
I can set the resourceName to anything I want, but there is no option to omit the nesting. Setting it to null or undefined does not help. And looking at the current implementation I don't think it would work.
I found people asking about this, but it seems like they've been using older version of ember-simple-auth. If I read the history correctly the "root key" became mandatory here.
In case anyone bumps into this, custom authenticator that is compatible with devise-token-auth gem should be something like: https://gist.github.com/MichalBryxi/c4ecb2896af247cc36c0faa37556b55a
Would it make sense to add this as an authenticator directly to ember-simple-auth so that people don't need to monkey-patch it manually?