Customized Login page: check if user is already signed in

We currently utilize a customized login page to implement home realm discovery using an external service.
However, we’ve found that the customized page and therefore the HRD logic is being run on some “non-login” pages.
User security image selection, mfa enroll, to name a few.

We’d like to implement a check to see if the user is already signed in and to exit the logic pre-emptively.
From playing around in the console, I’ve found that oktaData.requestContext.user is defined when the user is already signed in.
Just wondering if there is a better way to check if the user is already signed in?


Is this for a self host Okta sign-in widget or are you using auth-js?

If using either you can use the sessions API, Sessions

This is a AJAX call which relies on sending the Okta session cookie, so if your application and the Okta Org URL being used are not in the same domain the browser will need to allow 3rd party cookies for the call to work.

Thank You,

1 Like