# Get Auth Token From Okta

**URL:** <https://devforum.okta.com/t/get-auth-token-from-okta/12528>\
**Category:** Questions\
**Created:** [January 17, 2021, 10:39pm UTC](https://devforum.okta.com/t/get-auth-token-from-okta/12528 "2021-01-17T22:39:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adandamu](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@adandamu](https://devforum.okta.com/u/adandamu)\
**Post date:** [January 17, 2021, 10:39pm UTC](https://devforum.okta.com/t/get-auth-token-from-okta/12528/1 "2021-01-17T22:39:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@erik](https://devforum.okta.com/u/erik)\
**Post date:** [January 19, 2021, 1:25am UTC](https://devforum.okta.com/t/get-auth-token-from-okta/12528/2 "2021-01-19T01:25:26Z")

</div>

Hello,  
If a user context is not needed the [client credentials](https://developer.okta.com/docs/guides/implement-client-creds/overview/) flow should be used. It requires the client id and secret.

If a user context is needed, then the [resource owner password](https://developer.okta.com/docs/guides/implement-password/overview/) flow can be used. This requires the client id and secret, along with a username and password.

---

<div class="post-metadata">

**Author:** ![rajnadimpalli](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@rajnadimpalli](https://devforum.okta.com/u/rajnadimpalli)\
**Post date:** [January 19, 2021, 10:47am UTC](https://devforum.okta.com/t/get-auth-token-from-okta/12528/3 "2021-01-19T10:47:14Z")

</div>

> [@adandamu](#):
>
> okta using rest api’s. Can someone point me to the right article as to what the request or request chain should look like?

You are looking for resource owner password flow: [Implement authorization by grant type | Okta Developer](https://developer.okta.com/docs/guides/implement-password/use-flow/)

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 26, 2024, 6:07pm UTC](https://devforum.okta.com/t/get-auth-token-from-okta/12528/4 "2024-01-26T18:07:24Z")

</div>

Closed on January 26, 2024, 6:07pm UTC

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