Get Auth Token From Okta

Hi,

All the rest api examples i see on okta are redirecting the user to login screen and get the oauth token. What if i am trying to do the authentication on the backend and we can’t really use a prompt screen for login.

i have clientid, clientsecret, domain, username, password and i need a oauth token from okta using rest api’s. Can someone point me to the right article as to what the request or request chain should look like?

Thanks,
Anurag

1 Like

Hello,
If a user context is not needed the client credentials flow should be used. It requires the client id and secret.

If a user context is needed, then the resource owner password flow can be used. This requires the client id and secret, along with a username and password.

1 Like

You are looking for resource owner password flow: Implement authorization by grant type | Okta Developer

I’d strongly recommend using authorization code flow instead as the above flow is not secure.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.