Guides

Hosted login

ulex's hosted sign-in page: the endpoints that exist, the password and passkey forms, the upstream OIDC and SAML buttons it renders for a tenant's active connections, and what is deliberately not there yet.

ulex ships a hosted sign-in page so your application does not have to build one. It is for humans.

Warning

GET /auth/{appId} and POST /auth/{appId} return HTML and are not an API. An agent should never drive them. ulex_simulate_login performs the identical authorization transaction server-side and returns JSON, including a real authorization code. If your agent is parsing HTML, it has taken a detour with a worse outcome.

#Endpoints

EndpointMethodCredentialPurpose
/auth/{appId}GETnonethe sign-in page; carries the authorize parameters as hidden fields
/auth/{appId}POSTnoneverifies credentials, mints a session and a code, redirects to redirect_uri
/oauth2/authorizeGETnonethe standards-compliant authorization endpoint; hands off here when there is no session

There is no /auth/{appId}/callback, no SLO endpoint, no session cookie, no branding, no localisation, and no device-code page. Those are documented here as absent so nobody builds against them: the sections below describe only what the routes do today.

Upstream enterprise SSO is offered on the page, and completes: ulex federates over OIDC and, as a service provider, over SAML. See SAML SP integration and OIDC client integration.

Prefer /oauth2/authorize in the redirect for anything programmatic. It is the endpoint every OIDC library knows, it produces the standard code/state parameters, and it hands off to the page with every parameter preserved.

#Opening it

You do not link to the page directly. Send the user to /oauth2/authorize with a standard authorization request; without a session it answers 302 to /auth/{appId} with every parameter preserved:

http
GET https://ulexid.com/oauth2/authorize?response_type=code
  &client_id=client_01M3PSV7J8TBSPHG95CYSEX32B
  &redirect_uri=https%3A%2F%2Fapp.example.com%2Fauth%2Fcallback
  &scope=openid%20email%20profile
  &state=st_9Kq2WmB7yLt4NxZ
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
http
302 Found
Location: https://ulexid.com/auth/app_01M3PSV7J8TBSPHG95CYSEX32B?response_type=code&client_id=...&...

#What it renders

A form for email and password, plus two optional sections:

  • Upstream IdP buttons, one per active connection whose strategy federates (oidc, the seven named *_oidc variants, generic_oauth2, and saml). Each links straight to that connection's authorize route carrying the whole authorize request, so clicking one is a 302 to your identity provider and the return trip finishes the authorization that was already in progress.
  • A Mock SSO section, when the tenant allows simulator affordances: one email field and one button.

A draft, inactive or deleted connection gets no button — it has not been verified, so a button would be a promise the route refuses to keep. Neither does a strategy with no authorize route to click into.

html
<a class="federated" rel="nofollow"
   href="https://ulexid.com/oauth2/connections/con_01M3.../authorize?response_type=code&amp;client_id=...&amp;redirect_uri=...&amp;state=...&amp;code_challenge=...&amp;code_challenge_method=S256">Continue with Acme Corp (Okta)</a>
Warning

An organization-scoped connection only appears once you have typed an email at a domain it has verified. Connection names are written by your operator for your own users, and Acme Corp (Okta) on a public sign-in page tells any anonymous visitor who the customer is and which IdP they bought. A connection with an organization_id is therefore withheld until the submitted address matches one of its domains with domains_state: "verified" — the same routing rule the rest of the product uses. A tenant-level connection has no organization behind it and discloses nothing, so it is always shown.

Below the buttons, always:

html
<form method="post" action="">
  <input type="hidden" name="response_type" value="code">
  <input type="hidden" name="client_id" value="client_01M3PSV...">
  <input type="hidden" name="redirect_uri" value="https://app.example.com/auth/callback">
  <input type="hidden" name="state" value="st_9Kq2WmB7yLt4NxZ">
  <input type="hidden" name="code_challenge" value="E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM">
  <input type="hidden" name="code_challenge_method" value="S256">
  <input type="hidden" name="method" value="password">
  <label for="email">Email</label>
  <input id="email" name="email" type="email" required>
  <label for="password">Password</label>
  <input id="password" name="password" type="password" required>
  <button type="submit">Sign in</button>
</form>

Below that, a passkey option, and below that the Mock SSO section when simulator affordances are enabled.

Set the password beforehand with POST /api/v1/users/:id/password (admin scope) or ulex_set_user_password. Passwords are scrypt digests on the user row, stripped from every read; setting one revokes the user's sessions.

#Completing the flow

A correct submission answers 302 to the registered redirect_uri with code (and state, when one was sent). A code from the login is identical to any other code: 60 seconds, single-use, redeemed at /oauth2/token with the code_verifier.

The authorize request is re-validated from the hidden fields on POST — client, exact redirect_uri, scope, PKCE, response_mode — so a tampered form fails closed before any redirect is built. response_mode=form_post is honored with an auto-submitting form; anything else uses the query redirect.

#Error states

SituationWhat the human sees
redirect_uri not registered, or any other invalid authorize fielda rendered error page, not a redirect
unknown application idthe same rendered error page, no redirect target
wrong password, unknown email, inactive or deleted accountthe login page again with "Email or password is incorrect" — one message for all four, so none is an oracle
mock email unknown to every mock_sso connectionthe login page with "Mock sign-in has no such user"
mock sign-in on a tenant that disallows itaccess_denied
prompt=nonelogin_required, exactly as /oauth2/authorize answers
Note

Errors redirect to your callback only when both redirect_uri and state validate. Redirecting an unvalidated URI is how open redirects happen, so ulex renders instead. If your integration is surprised by HTML where it expected a redirect, this is why.

#The agent's path

You wantDo thisNot this
A code for a userulex_simulate_logindrive the HTML form with a cookie jar
A user with a passwordulex_set_user_passwordwrite password_hash (rejected everywhere it would stick)
To see the UIopen it in a browserparse the HTML
A failuresubmit a wrong passwordprovoke a real one

#Reference