The Embedded UI supports multiple authentication methods. The host page is responsible for initiating authentication before or after mounting a module. This reference covers supported auth methods, the authentication flow, and the in-embed login behavior. To enable out-of-the-box authentication, pass the autoLogin: true flag when calling mountModule().
Supported Authentication Methods
The diagram below shows the decision tree the runtime uses to determine which authentication path to follow. Starting from a module request, the runtime checks whether the end-user is already authenticated and then routes to the appropriate method based on how the host page is configured.
graph TD
A["Module Request"] --> B{"Authenticated?"}
B -->|"Yes"| C["Mount directly"]
B -->|"No"| D{"Auth Method"}
D -->|"Anonymous"| E["POST /auth/customAuth"]
D -->|"SAML"| F["Open iframe to SAML IdP"]
D -->|"OIDC"| G["Open iframe to OIDC OP"]
D -->|"Login Form"| H["Render login in embed"]
D -->|"Refer String"| I["POST /auth/refer"]
E --> C
F --> J["framedAuthComplete via postMessage"]
G --> J
H --> K["Login success via custom event"]
I --> C
J --> L["runtime.reloadModule()"]
K --> L
L --> C
Authentication Methods
The table below lists every supported authentication method along with the runtime API call and a plain-language description of what each method does.
| Method | API | Description |
|---|---|---|
| Check authentication | runtime.isAuthenticated() |
Returns true if the current session is already authenticated. Use this method before choosing an auth method so you do not re-authenticate an active session. |
| Anonymous | runtime.authenticateAnonymous({ moduleId }) |
Authenticates without credentials using the /auth/customAuth endpoint. Use this method for public-facing modules that do not require a login. |
| Refer String | runtime.authenticateReferString(referString) |
Authenticates using a one-time refer string from the Unqork Customer API. The string is passed directly to /auth/refer. |
| SAML | runtime.getSamlEntrypointUrl(idp) |
Returns the SAML redirect URL for the specified identity provider. Open this URL in an iframe or popup window to complete SAML authentication. |
| OIDC | runtime.getOidcEntrypointUrl(op) |
Returns the OIDC redirect URL for the specified OpenID Connect provider. Open this URL in an iframe or popup to complete OIDC authentication. |
| Login form | runtime.getLoginEntrypointUrl() |
Returns the login form URL for Unqork's built-in login. Open this URL in an iframe to render the login form inside the host page. |
| Wait for iframe auth | runtime.waitForAuthFrameCompletion(iframe) |
Returns a promise that resolves when the authentication iframe or popup finishes its flow. Use this method after opening a SAML, OIDC, or login iframe to pause execution until authentication is complete. |
| Auth callback | runtime.onAuthComplete(callback) |
Registers a callback that fires when in-embed login completes. Returns an unsubscribe function so you can remove the listener when it is no longer needed. |
In-Embed Login Flow
This flow applies when an end-user is not yet authenticated and the embedded module contains a login form. Instead of redirecting the end-user to a separate login page, the login form renders inside the embedded module on the host page.
- The login form renders inside the embedded module.
- The end-user submits credentials, triggering Angular's
LoginController. - On success, an
unqork-embed-auth-completeCustomEvent is dispatched onwindow. - The host page's
onAuthCompletecallback fires. - The callback calls
runtime.reloadModule(moduleId). - The module re-renders with the authenticated user context.
CORS Configuration
Cross-Origin Resource Sharing (CORS) controls which external domains can make requests to the Unqork server. Because an embedded module on your host page sends API calls to the Unqork environment, you must explicitly allow your host domain. Without this configuration, the browser blocks those requests with Access-Control-Allow-Origin errors and the module fails to load.
To configure CORS, go to Administration > Environment Settings > Environment > Environment Administration and add your host domain to the Allowed Origins List. Separate multiple domains with commas.
When the host page and the Unqork server are on different domains, browser cookie policies can also interfere. Session cookies must be marked SameSite=None; Secure to work across origins. If cookies are missing these attributes, authenticated sessions may fail in modern browsers, especially in private or incognito mode.
Changelog
| Date | Change |
|---|---|
| 2026-04-21 | Initial publication. |
| 2026-06-11 | Editorial pass: corrected "behaviour" to "behavior," split run-on intro sentence, added description paragraphs to Mermaid diagram and all H2 sections, expanded CORS section for non-expert readers, expanded Authentication Methods table descriptions, updated internal links. |
| 2026-06-15 | Added Access-Control-Allow-Origin error detail to CORS section; added Module Setup to See Also. |