Documentation

Getting started

Check the session without redirecting

Example of how to query the session with user() and handle the signed-out state in your own interface, without starting the automatic redirect.

1 min read

requireUser() starts the redirect to the login page when there is no session. That is not always what you want: on a public page, for example, you usually just need to know whether the visitor is signed in and adapt the interface. For that, use user(), which only queries the session and never redirects.

Example

html
<script src="https://cdn.infinity6.ai/releases/sdkweb/latest/bundle/i6sdk-web.js"></script>
<script type="module">
  const sdk = window.I6Sdk;

  async function main() {
    const user = await sdk.auth().user();

    if (user) {
      // Active session: show the signed-in area.
      document.querySelector("#signed-in-area").hidden = false;
    } else {
      // No session: show a login button instead of redirecting.
      document.querySelector("#login-button").hidden = false;
    }
  }

  main();
</script>

Points of attention

  1. user() returns null when there is no session, without starting any redirect — your page decides what to do next.
  2. If login is mandatory in some flow, switch from user() to requireUser() only in that flow.
  3. The call depends on third-party cookies between your page and the platform; see the per-browser limitations in Cookies and CORS.

Full reference

Support

Implementation support

Official channels for questions during integration.

Response within 1 business day

Technical support email

Response within 1 business day

Send implementation questions with the context of your current step.

Send email
Coming soon

WhatsApp

Response according to the support queue

Direct assistance for quick integration questions.

Available

Support assistant

Immediate response

i6 documentation and implementation assistant.