OAuth + bearer tokens
Connect agents with durable tokens you can scope, rotate, and revoke without touching a personal login.
Bearer auth for MCP — API keys, OAuth 2.1 with PKCE, dynamic client registration, token lifetimes, errors.
MCP authenticates with a bearer token. Either an aly_* API key (long-lived, owner-issued) or an aly_oauth_* OAuth token (consent-issued, refreshable). Both formats are accepted on the same Authorization header.
Header
Authorization: Bearer aly_a8d9c1...e3c7Content-Type: application/jsonAPI key flow
- Go to Aly → Settings → API keys.
- Click New key, name it, pick scopes.
- Copy the key once. It starts with
aly_. - Put it in your MCP client config under
Authorization: Bearer ....
OAuth 2.1 flow
For multi-tenant integrations where each user installs the integration into their own workspace.
1. Register the OAuth client
Use dynamic client registration, or register a static client in the dashboard. You'll receive a client_id and client_secret.
2. Send the user to consent
GET https://aly.store/oauth/authorize ?response_type=code &client_id=<id> &redirect_uri=<uri> &scope=read:sites read:content read:orders &state=<random> &code_challenge=<pkce> &code_challenge_method=S2563. Exchange the code
curl -X POST https://aly.store/oauth/token \ -d grant_type=authorization_code \ -d code=<code> \ -d redirect_uri=<uri> \ -d client_id=<id> \ -d client_secret=<secret> \ -d code_verifier=<pkce-verifier>The response body contains access_token (aly_oauth_*), refresh_token, expires_in, and the granted scope string.
4. Call MCP
Use the access token exactly as you would an API key — Authorization: Bearer aly_oauth_....
Discovery
OAuth 2.1 metadata is published in standard form:
curl https://aly.store/.well-known/oauth-authorization-serverToken lifetime
| API key | OAuth access token | OAuth refresh token | |
|---|---|---|---|
| Default lifetime | Indefinite until revoked | 1 hour | 30 days, rotating |
| Revocable | Yes — dashboard | Yes — /oauth/revoke | Yes — /oauth/revoke |
| Refreshable | N/A | Via refresh token | Rotated on use |
Errors
| Status | Meaning | Action |
|---|---|---|
| 401 | Missing or invalid token | Mint a new key or refresh. |
| 403 | Token valid, scope insufficient | Reissue with the needed scope. |
| 429 | Rate limit | Honor Retry-After. |
Was this page helpful?