<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00007EoSTUCA3Okta Classic EngineSingle Sign-OnAnswered2024-03-25T23:19:39.000Z2021-10-19T21:22:57.000Z2021-10-21T23:56:11.000Z

b71b7 (b71b7) asked a question.

OpenID Connect usernameClaim only works with email address

We are in the process of testing our first application on Okta. We are using Tomcat with an openid authenticator that redirects back to out Okta endpoint and requests claims. It works if we request email, but we are unable to get the username.

 

I know normally a username has to be an email address, but what if it does not match the email address? Is there a way to get that data? We have tried:

 

"name",

"username",

"preferred_username" (this seems to be the most logical option from googling and Okta Developer kb)

"profile.preferred_username"

"profile.name"

 

Nothing seems to work except usernameClaim="email"

 

This is the authenticator we are using: https://github.com/boylesoftware/tomcat-oidcauth

 

Any help on this is greatly appreciated. Thank you!


MalindaR.95016 likes this.
  • b71b7 (b71b7)

    Solved... it turns out we were requesting "email" scope, and we needed to request "profile" scope. After this change, "preferred_username" claim works... 🙂

     

    Anyone who sees this and is using this authenticator: https://github.com/boylesoftware/tomcat-oidcauth setting the following works for using User Name as the claim:

     

    usernameClaim="preferred_username" additionalScopes="profile"

     

    Expand Post
    Selected as Best
This question is closed.
Loading
OpenID Connect usernameClaim only works with email address