# Login into Okta app with automation fails

**URL:** <https://devforum.okta.com/t/login-into-okta-app-with-automation-fails/12852>\
**Category:** Questions\
**Created:** [February 9, 2021, 5:13pm UTC](https://devforum.okta.com/t/login-into-okta-app-with-automation-fails/12852 "2021-02-09T17:13:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![knsankar](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@knsankar](https://devforum.okta.com/u/knsankar)\
**Post date:** [February 9, 2021, 5:13pm UTC](https://devforum.okta.com/t/login-into-okta-app-with-automation-fails/12852/1 "2021-02-09T17:13:56Z")

</div>

Hi All,

I am trying to create some automation through an application APIs that has Okta authentication (oidc implemented with nginx+vouch).

```
I got sessionToken from /api/v1/authn
Got the code from /oauth2/v1/authorize
I got bearer token from /oauth2/v1/token

```

When I try to access my application’s API by sending a GET with header "Authorization: Bearer {Token}, My application redirects me to Okta login page.

I am stuck with it for a long time and couldn’t identify the issue.

Thanks in advance.

---

<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:** [February 9, 2021, 6:11pm UTC](https://devforum.okta.com/t/login-into-okta-app-with-automation-fails/12852/2 "2021-02-09T18:11:40Z")

</div>

Hello,  
We would need more details about your application and the backend end you are trying to access with the access token. From what you have provided my first thought, is the application API you are trying to access your own application or an Okta API? If it is your own API, are the URL paths you provided correct  
`/oauth2/v1/authorize`

This would indicate that you are getting your tokens from the Org Authorization server and not a custom Authorization server. The access token minted from the Org Auth server can only be used to access Okta APIs, not your own APIs. More info on Auth server types can be found [here](https://developer.okta.com/docs/concepts/auth-servers/#available-authorization-server-types).

If this is not the problem please provide more details about your application and the resource being accessed with the token.

---

<div class="post-metadata">

**Author:** ![knsankar](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@knsankar](https://devforum.okta.com/u/knsankar)\
**Post date:** [February 18, 2021, 9:13pm UTC](https://devforum.okta.com/t/login-into-okta-app-with-automation-fails/12852/3 "2021-02-18T21:13:43Z")

</div>

Hi Erik,

Thanks for your response.

I am using Org Authorization server to get bearer tokens. (`https://okta.company.com/oauth2/v1/authorize`)

Using the bearer token as Authorization header, I am trying to access a application API that is behind the Okta authentication (`https://app.company.com/api/list`).

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [February 18, 2021, 10:39pm UTC](https://devforum.okta.com/t/login-into-okta-app-with-automation-fails/12852/4 "2021-02-18T22:39:41Z")

</div>

@knsankar Hi, if you are trying to get access token with code. Please refer the below doc  
[https://developer.okta.com/docs/guides/implement-auth-code/exchange-code-token/](https://developer.okta.com/docs/guides/implement-auth-code/exchange-code-token/)

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 26, 2024, 11:36pm UTC](https://devforum.okta.com/t/login-into-okta-app-with-automation-fails/12852/5 "2024-01-26T23:36:39Z")

</div>

Closed on January 26, 2024, 11:36pm UTC


