# Rexplore ID for developers (/rexplore-id/developers)

> Let people sign in to your app with Rexplore ID, a standard OpenID Connect provider with PKCE, rotating refresh tokens and a public JWKS.

Rexplore ID is an **OpenID Connect** provider. Any OIDC or OAuth 2.0 client library can use it: your app redirects the browser to Rexplore ID, the user signs in, and your app exchanges the returned code for tokens. Your app never handles passwords.

## Discovery [#discovery]

| | |
| --- | --- |
| **Issuer** | `https://auth.rexplore.ai` |
| **OpenID configuration** | `https://auth.rexplore.ai/.well-known/openid-configuration` |
| **OAuth server metadata** | `https://auth.rexplore.ai/.well-known/oauth-authorization-server` |
| **JWKS** | `https://auth.rexplore.ai/.well-known/jwks.json` (also at `/api/auth/jwks`) |

Configure your library with the issuer and let it read the discovery document; the endpoints below are listed for reference.

## Endpoints [#endpoints]

| Endpoint | URL |
| --- | --- |
| Authorization | `https://auth.rexplore.ai/api/auth/oauth2/authorize` |
| Token | `https://auth.rexplore.ai/api/auth/oauth2/token` |
| UserInfo | `https://auth.rexplore.ai/api/auth/oauth2/userinfo` |
| Revocation | `https://auth.rexplore.ai/api/auth/oauth2/revoke` |
| Introspection | `https://auth.rexplore.ai/api/auth/oauth2/introspect` |
| End session (logout) | `https://auth.rexplore.ai/api/auth/oauth2/end-session` |

## Scopes [#scopes]

| Scope | Grants |
| --- | --- |
| `openid` | Required. Returns an ID token with the user's `sub`. |
| `profile` | `name` and `picture` in the ID token and UserInfo |
| `email` | `email` and `email_verified` |
| `offline_access` | A refresh token, so your app can stay signed in |

## The authorization code flow [#the-authorization-code-flow]

Rexplore ID supports the **authorization code** grant with **PKCE** (`code_challenge_method=S256`). PKCE is required for public clients (mobile apps and single-page apps) and recommended for every client.

```mermaid
sequenceDiagram
    participant U as User
    participant A as Your app
    participant R as Rexplore ID
    U->>A: Click Sign in
    A->>R: Redirect to /authorize (client_id, redirect_uri, scope, state, code_challenge)
    R->>U: Sign in (password or Google, plus two-step if on)
    R->>A: Redirect to redirect_uri with code and state
    A->>R: POST /token (code, code_verifier)
    R->>A: access_token, id_token, refresh_token
    A->>U: Signed in
```

### 1. Redirect to Rexplore ID [#1-redirect-to-rexplore-id]

```text
https://auth.rexplore.ai/api/auth/oauth2/authorize
  ?response_type=code
  &client_id=YOUR_CLIENT_ID
  &redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback
  &scope=openid%20profile%20email%20offline_access
  &state=RANDOM_STATE
  &code_challenge=BASE64URL_SHA256_OF_VERIFIER
  &code_challenge_method=S256
```

Optional parameters:

| Parameter | Effect |
| --- | --- |
| `login_hint=ada@example.com` | Pre-fills the email field |
| `prompt=create` or `screen=sign-up` | Opens **Create account** instead of sign-in |

### 2. Exchange the code [#2-exchange-the-code]

```bash
curl -X POST https://auth.rexplore.ai/api/auth/oauth2/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d grant_type=authorization_code \
  -d code=AUTHORIZATION_CODE \
  -d redirect_uri=https://app.example.com/callback \
  -d client_id=YOUR_CLIENT_ID \
  -d code_verifier=ORIGINAL_CODE_VERIFIER
```

Confidential (server-side) clients also authenticate with their client secret.

### 3. Refresh [#3-refresh]

```bash
curl -X POST https://auth.rexplore.ai/api/auth/oauth2/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d grant_type=refresh_token \
  -d refresh_token=REFRESH_TOKEN \
  -d client_id=YOUR_CLIENT_ID
```

Store the new refresh token from every response: refresh tokens **rotate on each use**.

## Tokens [#tokens]

| Token | Format | Lifetime |
| --- | --- | --- |
| Access token | JWT signed with RS256 | 10 minutes |
| ID token | JWT signed with RS256 | 10 minutes |
| Refresh token | Opaque | 30 days, rotated on every use |

Reusing a refresh token that has already been exchanged revokes the whole token family (after a short grace period for retries), and the user has to sign in again. This protects against stolen refresh tokens.

Access tokens carry `iss` (`https://auth.rexplore.ai`), `aud` (the API the token is for), `sub`, `email`, `name`, `email_verified` and `sid`. There is no organization claim: workspace membership is resolved by each product.

### The `sub` claim [#the-sub-claim]

`sub` is the stable user ID. New accounts look like `rx|3f1c9a2e-...`. Accounts that existed before Rexplore ID launched keep their earlier identifier (for example `google-oauth2|...`). Treat `sub` as an opaque string and never parse it.

## Verify access tokens [#verify-access-tokens]

APIs that accept Rexplore ID access tokens verify them locally with the public JWKS: check the signature, `iss`, `aud` and expiry.

```ts tab="Node.js (jose)"
import { createRemoteJWKSet, jwtVerify } from 'jose';

const JWKS = createRemoteJWKSet(new URL('https://auth.rexplore.ai/.well-known/jwks.json'));

export async function verifyAccessToken(token: string) {
  const { payload } = await jwtVerify(token, JWKS, {
    issuer: 'https://auth.rexplore.ai',
    audience: 'YOUR_API_AUDIENCE',
    algorithms: ['RS256'],
  });
  return payload; // payload.sub, payload.email, ...
}
```

```python tab="Python (PyJWT)"
import jwt

jwks_client = jwt.PyJWKClient("https://auth.rexplore.ai/.well-known/jwks.json")

def verify_access_token(token: str) -> dict:
    signing_key = jwks_client.get_signing_key_from_jwt(token)
    return jwt.decode(
        token,
        signing_key.key,
        algorithms=["RS256"],
        issuer="https://auth.rexplore.ai",
        audience="YOUR_API_AUDIENCE",
    )
```

### Key rotation [#key-rotation]

Signing keys rotate every 90 days. The previous key stays in the JWKS for 30 days after rotation, so tokens signed just before a rotation keep verifying. Pick the key by the token's `kid` header, cache the JWKS, and refetch it when you see an unknown `kid`. Both libraries above do this for you.

## Register an app [#register-an-app]

Apps are registered by Rexplore. Email [hello@rexplore.ai](mailto:hello@rexplore.ai) with:

| Detail | Notes |
| --- | --- |
| App name, logo and home URL | Shown on the sign-in and consent screens |
| App type | **Web app**: a confidential client with a client secret, for server-rendered apps and backends. **Mobile or single-page app**: a public client without a secret that must use PKCE. |
| Redirect URIs | Exact URLs Rexplore ID may redirect to after sign-in. Must use `https://`, except `http://localhost` for development. |
| Post-logout redirect URIs | Where to send users after they sign out |
| APIs | Which APIs your app needs access tokens for |

You'll receive a client ID (and, for web apps, a client secret shown once).

### Branded sign-in pages [#branded-sign-in-pages]

Registered apps can have their own sign-in look: name, logo, colors and a short story column, with **Secured by Rexplore ID** under the form. Each app gets direct links:

```text
https://auth.rexplore.ai/sign-in/<app-slug>
https://auth.rexplore.ai/sign-up/<app-slug>
```

Users still sign in with the same Rexplore ID.

### MCP clients [#mcp-clients]

AI tools connecting to the [Luso8 MCP server](/developers/mcp) don't need manual registration: they register themselves with OAuth **dynamic client registration** and use the same authorization code and PKCE flow.

## Sign out [#sign-out]

To sign the user out of Rexplore ID as well as your app, redirect to the end-session endpoint with the ID token and one of your registered post-logout URIs:

```text
https://auth.rexplore.ai/api/auth/oauth2/end-session
  ?id_token_hint=ID_TOKEN
  &post_logout_redirect_uri=https%3A%2F%2Fapp.example.com%2F
```

## Not yet available [#not-yet-available]

Passkeys, enterprise SSO (SAML) and organization-enforced two-step verification are not available yet.