# Automating Authorization Code Flow

**URL:** <https://devforum.okta.com/t/automating-authorization-code-flow/6752>\
**Category:** Questions\
**Created:** [October 30, 2019, 9:45pm UTC](https://devforum.okta.com/t/automating-authorization-code-flow/6752 "2019-10-30T21:45:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [October 30, 2019, 9:48pm UTC](https://devforum.okta.com/t/automating-authorization-code-flow/6752/2 "2019-10-30T21:48:10Z")

</div>

Hi @vperiyasamy

You can authenticate the user via API using /api/v1/authn endpoint (doc [here](https://developer.okta.com/docs/reference/api/authn/#primary-authentication)) and retrieve a sessionToken. From there, you can pass the sessionToken as query parameter on the authorization endpoint and Okta will create the session automatically and redirect the user to the callback endpoint (doc [here](https://developer.okta.com/docs/guides/session-cookie/overview/#retrieving-a-session-cookie-via-openid-connect-authorization-endpoint)).

---

_[View the full topic](https://devforum.okta.com/t/automating-authorization-code-flow/6752)._
