Getting Groups in React App


#1

I followed the React Simple app example and I can authenticate users using the Okta Preview app I configured. However, I want to access Groups. The docs say that I can configure it on the App page -> Sign On tab -> Groups claim. But I only see Token Credentials and SignOn Policy on that page.

Any ideas?


#2

Hi Joe,

Did you add the claim to the access token? This can be achieved by going API -> Authorization Server -> and selecting the default server. Within that menu, you have the ability to configure the claim’s within that Access Token and access the groups assigned to that user.

Let me know if that works for you.

Best,

Mike


#3

Thanks - I added it so now I have a “groups” scope and I added the claim that matches on regex .*

When I use the Token Preview, I can see the groups in the payload:

“groups”: [
“Everyone”,
“Admins”
]

But I’m not see in it in the React JS code. I make a call to:

this.props.auth.getUser()

and the resulting user object doesn’t have the groups. My scope in the Security block is set to:

scope={[‘openid’,‘email’,‘profile’,‘groups’]}