
Jaskaranjits.19839 (Customer) asked a question.
I am building .net core web api already using Okta for authentication but i am stuck while dealing with authorization. When i sign in using Authorization code flow (with PKCE) i get groups in ID TOKEN but not in access token. But when sent request to server from my SPA i only send access token. How my server will know what group user belong to so it can protect endpoint accordingly.

Hi Jaskaranjit,
You can create a custom claim inside one of the authorization servers that you would be using following the steps available in our documentation https://help.okta.com/en/prod/Content/Topics/Security/API_Access.htm?cshid=create-claims#create-claims and https://developer.okta.com/docs/guides/customize-tokens-returned-from-okta/dynamic-whitelist-custom-as/. The claim created will be inside the access token and will contain the user's group memberships.
For further assistance we would also suggest you to create a support ticket regarding this issue so our team could look over your particular case and assist you in troubleshooting.
Thank you,
Andrei Popescu
Technical support engineer
Okta Global Customer Care
Another option would be to send the access token to the /userinfo endpoint to get this information: https://developer.okta.com/docs/reference/api/oidc/#userinfo