How to get SSWS {{apikey}} and roles?

Hello All,

I am new to Okta and I have okta sandbox details only. Can anyone please tell me where I get the roles for a particular user and how can i get the API key for the SSWS {{apikey}} for the postman?

You can call /api/v1/users/${userId}/roles to list the admin roles for a user.
An SSWS API key cannot be generated via an API call, you must generate it in the UI (while logged in as the admin user in question, of course).

If you need something more programmatic, you may want to considering using OAuth to authorize the calls to Okta instead. More details here: Implement OAuth for Okta | Okta Developer and Implement OAuth for Okta with a service app | Okta Developer

1 Like

Thanks, @andrea for the response. I am using authorization code flow with the PKCE method and I received the access token as well, but when I want to make calls for another APIS, I need an API key in the header. I tried with the access token key but got an unauthorized token error. So not sure what is the main reason for it.

If the user’s access token has high enough admin privileges to make the request (for /roles, they would need to be an admin that is allowed to read users), then you can add the access token to the auth header as a Bearer token (e.g, change it from SSWS {{apikey}} to Bearer {{access_token}}).

End-users without admin permissions will not be able to access this information with their access token