# React app: using useOktaAuth vs okta config directly

**URL:** <https://devforum.okta.com/t/react-app-using-useoktaauth-vs-okta-config-directly/31946>\
**Category:** OAuth/OIDC\
**Tags:** react\
**Created:** [February 11, 2025, 12:37pm UTC](https://devforum.okta.com/t/react-app-using-useoktaauth-vs-okta-config-directly/31946 "2025-02-11T12:37:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![justasam](https://avatars.discourse-cdn.com/v4/letter/j/6a8cbe/32.png) [@justasam](https://devforum.okta.com/u/justasam)\
**Post date:** [February 11, 2025, 12:37pm UTC](https://devforum.okta.com/t/react-app-using-useoktaauth-vs-okta-config-directly/31946/1 "2025-02-11T12:37:08Z")

</div>

Hi, is there a difference between using `useOktaAuth` and simply importing `export const oktaAuth = new OktaAuth({...})` directly?

I can see that the exported oktaAuth gets updated access token/etc, and it allows usage where hooks are normally not allowed, so I wonder what are the differences.

---

<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:** [March 13, 2025, 12:37pm UTC](https://devforum.okta.com/t/react-app-using-useoktaauth-vs-okta-config-directly/31946/2 "2025-03-13T12:37:09Z")

</div>

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