简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM