Connect and sign in

OAuth sign-in How it works

OAuth 2.1 for public clients: authorization code with PKCE S256, no client secret, consent on Xale's own page, opaque bearer tokens.

View as Markdown

The shape

  • OAuth 2.1, public clients only: no client secret, token_endpoint_auth_methods_supported: ["none"].
  • Authorization code with PKCE; S256 is required.
  • Clients register themselves (RFC 7591), but only with the known apps' callback addresses or a loopback address. See Dynamic client registration.
  • The person approves on Xale's own page, signed in to their Xale account.

Discovery

A call to /api/mcp without a valid token gets 401, JSON-RPC code -32001 (“Sign in to Xale to use this connector.”), and:

text
WWW-Authenticate: Bearer resource_metadata="https://xale.app/.well-known/oauth-protected-resource/api/mcp", scope="read write:memories write:intentions write:changes"

When a token was sent but isn't valid (expired, revoked, unknown), the header adds error="invalid_token", error_description="Connect the app to Xale again."

DocumentAddressStandard
Protected resource metadata/.well-known/oauth-protected-resource and /.well-known/oauth-protected-resource/api/mcpRFC 9728
Authorization server metadata/.well-known/oauth-authorization-server, also served at /.well-known/openid-configurationRFC 8414

Both are public, with Cache-Control: public, max-age=300. The authentication challenge lists the default AI scopes. The discovery documents also advertise read:now for a display-only client.

Authorization server metadata

FieldValue
issuerhttps://xale.app
authorization_endpointhttps://xale.app/oauth/authorize (a Xale page)
token_endpointhttps://xale.app/api/oauth/token
registration_endpointhttps://xale.app/api/oauth/register
revocation_endpointhttps://xale.app/api/oauth/revoke
scopes_supportedread, read:now, write:memories, write:intentions, write:changes, offline_access
response_types_supportedcode
response_modes_supportedquery
grant_types_supportedauthorization_code, refresh_token
code_challenge_methods_supportedS256
authorization_response_iss_parameter_supportedtrue

The authorization request

Parameters read: client_id, redirect_uri, response_type, code_challenge, code_challenge_method, state, scope, resource. Any of them sent twice is refused.

CheckIf it fails
client_id is a registered clientXale's page says so; no redirect
redirect_uri matches a registered one (it may be left out when the client registered exactly one)Xale's page says so; no redirect
state is at most 2,048 charactersXale's page says so; no redirect
response_type=codeRedirect with unsupported_response_type
code_challenge is 43 characters: letters, digits, - and _Redirect with invalid_request
code_challenge_method=S256Redirect with invalid_request
resource, if sent, is https://xale.app/api/mcp (a trailing slash is ignored)Redirect with invalid_target
Every scope is one Xale offers (identity scopes are ignored)Redirect with invalid_scope

Request scope=read:now explicitly for a display. Consent offers only the display permission. See Scopes for the scope combinations and Now and Up Next for the desktop Python example.

Every redirect back carries iss=https://xale.app, and state when you sent it.

What the person sees

  • Signed out: a preview of who is asking, and Sign in to Xale. Cancel returns access_denied.
  • Signed in: the app's name, “It will be able to:”, the read permission, and each write permission as a box they can untick, then Allow or Cancel.
  • On a Free account the page says “Connecting your own AI to Xale is part of Xale Pro.” instead of a working Allow. See Xale Pro · required for connecting.

The app's name comes from its callback address, never from its own client_name: Claude, ChatGPT, Grok, “A Google app, such as Gemini”, or, for a loopback address, “An app on this computer (it calls itself “…”)”.

Timings

StepLasts
A consent (the page's record of exactly what was asked)10 minutes, single use, tied to the account that opened it
The authorization code5 minutes, single use

On Allow, Xale starts a fresh connection and returns the code; any earlier connection of the same client ends. If the account has no time zone saved, the browser's zone is saved then.

The token request

POST /api/oauth/token, form-encoded: grant_type=authorization_code, code, code_verifier (43–128 characters), client_id, and redirect_uri when you sent one to ask. The answer and refresh rules are on Tokens · expiry and refresh.

  • Checked against main 5692de55

Was this helpful?

oauth-sign-in-how-it-works.md · main@c1725f34