Sign in with EmpirioLabs AI
Your app can ask people to connect their EmpirioLabs AI account instead of pasting an API key. They approve your app on the EmpirioLabs AI consent screen, your app receives an access token of its own for that account, and they can disconnect it at any time under Settings > Connected applications. Usage is billed to the account that approved it, at the same prices and limits as the API.
The EmpirioLabs AI CLI signs in this way, and so do apps that connect to the MCP server.
Endpoints
Read the metadata document at startup rather than hard-coding the other URLs.
Identify your app
Use one of these as your client_id:
-
A client metadata document (recommended). Host a JSON document at an
https://URL you control and use that URL as theclient_id. The consent screen shows itsclient_nameand the site your redirect URI returns to.title="https://example.com/oauth/client.json" -
Dynamic client registration.
POSTthe same fields (withoutclient_id) as JSON to the registration endpoint and store theclient_idit returns. Up to 20 redirect URIs are accepted.
Redirect URIs must use https, or plain http on 127.0.0.1, localhost or [::1] for apps running on the user’s computer. A loopback redirect may use any port, so a native app can listen on whichever port is free (RFC 8252).
Connect an account
Send the user to the authorization endpoint
Create a random code_verifier and its S256 code_challenge, and a random state. Then open:
resource=https://api.empiriolabs.ai and scope=api ask for access to the API. Without them, the request is for the MCP server instead.
Disconnect
When the user signs out of your app, revoke the access token:
The endpoint answers 200 whether or not the token was still active. A disconnected or revoked token receives 401 from the API; ask the user to connect again.
Errors
Requirements
- Use PKCE with
S256on every request, and checkstateon every callback. - Request only
scope=apiwithresource=https://api.empiriolabs.ai. - Keep the access token out of URLs, logs and client-side code that other people can read.
- Give your app a recognizable
client_name, and redirect to your own site, so people recognize it on the consent screen.
