# checkSession returns login\_required after a few successful calls when using Universal Login with a Custom Domain

**URL:** <https://community.auth0.com/t/checksession-returns-login-required-after-a-few-successful-calls-when-using-universal-login-with-a-custom-domain/202133>\
**Category:** Get Help\
**Tags:** login-auth0, refresh\_token, login\
**Created:** [July 30, 2026, 10:39am UTC](https://community.auth0.com/t/checksession-returns-login-required-after-a-few-successful-calls-when-using-universal-login-with-a-custom-domain/202133 "2026-07-30T10:39:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhrupal.patel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dhrupal.patel/32/80019_2.png) [@dhrupal.patel](https://community.auth0.com/u/dhrupal.patel)\
**Post date:** [July 30, 2026, 10:39am UTC](https://community.auth0.com/t/checksession-returns-login-required-after-a-few-successful-calls-when-using-universal-login-with-a-custom-domain/202133/1 "2026-07-30T10:39:52Z")

</div>

**Title:** `checkSession` returns `login_required` after a few successful calls when using Universal Login with a Custom Domain

Hi everyone,

I’m facing an issue with `auth0.checkSession()` and would appreciate any guidance.

**Setup:**

- **Application Type:** Machine-to-Machine (M2M)
- **Authentication:** Universal Login
- **SDK:** Auth0.js
- **Custom Domain:** Enabled

**Issue:**

A user logs in successfully and the Auth0 session is maintained. After login, I call `auth0.checkSession()` approximately every 4 minutes to verify whether the user still has an active session.

Initially, `checkSession()` works as expected. However, after 2–3 successful checks, it starts failing with the following error:

```auto
login_required

```

This happens even though the user has not logged out and the session is expected to remain active.

**Questions:**

1. What could cause `checkSession()` to start returning `login_required` after a few successful calls?
2. Could this be related to session settings, browser behavior, or the use of a custom domain?
3. Are there any recommended configurations or best practices to prevent this issue?

Any suggestions or troubleshooting steps would be greatly appreciated.

Thank you!

---

<div class="post-metadata">

**Author:** ![gerald.czifra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.czifra/32/75301_2.png) [@gerald.czifra](https://community.auth0.com/u/gerald.czifra)\
**Post date:** [July 31, 2026, 12:04am UTC](https://community.auth0.com/t/checksession-returns-login-required-after-a-few-successful-calls-when-using-universal-login-with-a-custom-domain/202133/3 "2026-07-31T00:04:59Z")

</div>

Hi @dhrupal.patel

Thank you for reaching out to us!

I understand that are calling `auth0.checkSession()` about every 4 minutes to verify if a user still has a session, but it fails after a couple of checks.

Please allow us some time to research this matter and we will return with guidance in a timely manner.

Best regards,  
Gerald

---

<div class="post-metadata">

**Author:** ![dhrupal.patel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dhrupal.patel/32/80019_2.png) [@dhrupal.patel](https://community.auth0.com/u/dhrupal.patel)\
**Post date:** [July 31, 2026, 6:09am UTC](https://community.auth0.com/t/checksession-returns-login-required-after-a-few-successful-calls-when-using-universal-login-with-a-custom-domain/202133/4 "2026-07-31T06:09:41Z")

</div>

Thank you @gerald.czifra .

---

<div class="post-metadata">

**Author:** ![gerald.czifra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.czifra/32/75301_2.png) [@gerald.czifra](https://community.auth0.com/u/gerald.czifra)\
**Post date:** [July 31, 2026, 5:07pm UTC](https://community.auth0.com/t/checksession-returns-login-required-after-a-few-successful-calls-when-using-universal-login-with-a-custom-domain/202133/5 "2026-07-31T17:07:54Z")

</div>

Hi @dhrupal.patel

Thank you for your patience!

Generally speaking, the `login_required` error from `checkSession()` means that the Auth0 authorization server could not detect a valid session cookie within the hidden iframe it uses to silently renew tokens.

Before diving into the common culprits, there is a critical configuration detail to address in your setup: **Machine-to-Machine (M2M) applications are not designed for interactive user sessions.** M2M applications use the Client Credentials grant for backend API-to-API communication. Auth0.js, Universal Login, and `checkSession()` are meant for **Single Page Applications (SPAs)**. If your application is registered as M2M in the Auth0 dashboard, you should create a new SPA application and use those credentials.

### Potential causes why `checkSession()` might start failing after a few successful calls when using a Single Page Application:

### 1. Inactivity Timeout or Absolute Session Lifetime

Auth0 tenant settings define how long a session lives. If your tenant’s **Inactivity Timeout** (Require log in after X minutes) is reached, Auth0 destroys the session.

- Even though you are calling `checkSession()` every 4 minutes, silent authentication requests do _not_ automatically extend the inactivity window unless specifically configured to do so.

- Once the absolute lifetime or inactivity threshold is hit, the cookie expires, and `checkSession()` correctly returns `login_required`.

### 2. Custom Domain Initialization Mismatch

While you have a Custom Domain enabled, you must ensure that your `auth0.WebAuth` instance is actually using it.

- If your Auth0.js SDK is still initialized with your canonical domain (e.g., `your-tenant.auth0.com`) instead of your custom domain (e.g., `login.yourdomain.com`), the browser will treat the `checkSession` iframe request as cross-origin.

- Modern browsers (especially [Safari with ITP](https://auth0.com/docs/libraries/auth0js#:~:text=the%20browser%20must%20have%20third%2Dparty%20cookies%20enabled), or Chrome blocking third-party cookies) will eventually block the cookie in the iframe, causing the silent authentication to fail.

### 3. Using Auth0 Development Keys for Social Logins

If your users are [logging in via a social connection](https://auth0.com/docs/libraries/auth0js#:~:text=the%20connection%20is%20a%20social%20connection%20and%20you%20are%20using%20Auth0%20dev%20keys) (like Google or Facebook) and you are still using Auth0’s default development keys rather than providing your own Client ID and Secret in the Auth0 Dashboard, `checkSession()` will inherently fail and return `login_required` by design.

### 4. HTTP vs HTTPS Protocol Mismatches

If your app is hosted locally or behind a proxy that redirects HTTP to HTTPS, the iframe might be attempting to execute over HTTP while the cookies are marked as `Secure` (HTTPS only). This mismatch prevents the session cookie from being sent to Auth0.

* * *

### Recommended Troubleshooting Steps & Best Practices

1. Verify the App Type: Ensure your application is set up as a **Single Page Application** in the Auth0 Dashboard, not M2M.

2. Check SDK Initialization: Confirm that your Auth0.js initialization uses your custom domain for the `domain` parameter, not the default Auth0 tenant URL:

3. Review Session Limits: Go to **Auth0 Dashboard \> Tenant Settings \> Advanced**. Check the " Idle Session Lifetime" settings to ensure they align with your expected session longevity.

4. Configure Social Connections: If using social logins, ensure you have input your own keys in the Auth0 Dashboard under **Authentication \> Social**.

5. Check Browser Console & Network Tab: Open your developer tools, ensure “Preserve Log” is on, and watch the Network tab. Look for the iframe request to the `/authorize?prompt=none...` endpoint. Check if the Auth0 session cookie (`auth0`) is actually being attached to the Request Headers when the error occurs.

Hope this information helped troubleshoot and clear the issue on your end!

Have a great one,  
Gerald

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 6, 2026, 4:40am UTC](https://community.auth0.com/t/checksession-returns-login-required-after-a-few-successful-calls-when-using-universal-login-with-a-custom-domain/202133/6 "2026-08-06T04:40:27Z")

</div>

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