authenticationember.jsdeviseruby-on-rails-5ember-simple-auth

ember simple auth with rails devise username instead of email?


I have a rails api that I am using devise for the login routine. I hooked ember into that via ember simple auth. Got it up and running using a typical devise email and password. I typically configure devise though to use LDAP authentication which works great. The issue I am having is that I use a username for my LDAP login, not an email address. I usually change devise to look for a username and not an email address which I have done.

I am now getting a 401 unauthorized and looking at the params it looks like I am still sending an email across.

Can you change ember simple auth to send a username and not email? If so how do you do that?


Solution

  • You have to extend the devise authorizer and set the identificationAttributeName to username

    // app/authorizers/devise.js
    import DeviseAuthorizer from 'ember-simple-auth/authorizers/devise';
    
    export default DeviseAuthorizer.extend({
      identificationAttributeName: 'username'
    });
    

    Source: ember-simple-auth