0

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

One more question for this. How do I display the username on the page as being logged in. I have been trying currentUser.user, currentUser.username etc. and haven't been able to get it working.
Try session.data.authenticated.user_id. but it is better to create a service for currentUser as described here github.com/simplabs/ember-simple-auth/blob/…
Thanks I think I see the problem. I do not seem to be authenticated on the ember side. If I check for session.isAuthenticated on the page it is coming back false. When I look in ember inspector under session/main it says isAuthenticated true. I have to figure out what is going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.