Sign in with AppMecca (suite apps)¶
AppMecca is an OAuth 2.0 provider for its own suite apps, starting with AppMecca Meerkat. A user signed in to the Dashboard can open a suite app already signed in, and the two accounts are linked. Only apps a platform admin registered can use it; there is no consent screen.
The protocol is the authorization-code grant with PKCE (S256 only) and a confidential client. Identity comes from GET /api/oauth/me. There is no OpenID Connect: no ID token, no signing key, no discovery document and no refresh token.
The full contract, with every key and error, is docs/specs/sso/CONTRACT.md in the platform repository, and docs/specs/sso/contract/oauth-me.json is its machine-readable form. This page lists the endpoints.
| Endpoint | Called by | Credential |
|---|---|---|
GET https://dashboard.{env}…/oauth/authorize |
the browser | the Dashboard session cookie |
POST /api/auth/sso/authorize |
the Dashboard's authorize page only | the session, when present |
POST /api/oauth/token |
the suite app's server | client id + secret |
GET /api/oauth/me |
the suite app's server | Bearer oat_… (scope identity) |
GET /api/oauth/me/groups |
the suite app's server | Bearer oat_… (scope groups:read) |
POST /api/oauth/revoke |
the suite app's server | client id + secret |
GET /api/suite-apps |
the Dashboard | a session |
/api/admin/oauth-clients… |
the Dashboard's admin console | a platform-admin session |
⚠ An oat_ access token is not a platform credential. It lasts 10 minutes and works only on /api/oauth/me and /api/oauth/me/groups. Every other route treats it as no credential at all.
Authorize¶
A suite app sends the browser to the Dashboard:
https://dashboard.{env}.appmecca.net/oauth/authorize?client_id=amc_…
&redirect_uri=https://app.example/callback&response_type=code
&scope=identity%20groups:read&state=…&code_challenge=…&code_challenge_method=S256
Add prompt=none for a silent sign-in: with no Dashboard session the app gets error=login_required instead of a sign-in page.
The page passes the query to POST /api/auth/sso/authorize, which answers one of three outcomes:
{ "outcome": "redirect", "location": "https://app.example/callback?code=…&state=…" }
{ "outcome": "login" }
{ "outcome": "error_page", "error": "unknown_client" }
| Situation | Result |
|---|---|
Unknown or disabled client_id |
error page (unknown_client); never a redirect |
redirect_uri not registered exactly |
error page (unregistered_redirect_uri); never a redirect |
Bad response_type |
redirect with error=unsupported_response_type |
No state, bad PKCE, unknown prompt |
redirect with error=invalid_request |
A scope the app may not have, or openid |
redirect with error=invalid_scope |
| No session | login, or error=login_required with prompt=none |
| Session of a disabled account | redirect with error=access_denied |
| Signed in | redirect with code (60 s, single use) and state |
POST /api/oauth/token¶
curl -X POST https://api-url/api/oauth/token \
-d grant_type=authorization_code -d code=… -d redirect_uri=https://app.example/callback \
-d code_verifier=… -d client_id=amc_… -d client_secret=amcs_…
{ "access_token": "oat_…", "token_type": "Bearer", "expires_in": 600, "scope": "identity groups:read" }
HTTP Basic is accepted instead of the form credentials (not both). Every client-authentication failure is 401 {"error": "invalid_client"}, byte for byte. A bad code, a used or expired code, another app's code, a different redirect_uri or a wrong verifier is 400 {"error": "invalid_grant"}. A wrong verifier does not use up the code.
GET /api/oauth/me¶
{
"sub": "6f1c…",
"appmecca_user_id": "6f1c…",
"email": "ada@example.com",
"email_verified": true,
"name": "Ada Lovelace",
"session_expires_at": "2026-10-31T12:00:00+00:00",
"platform_admin": true
}
platform_admin appears only when the token holds that scope, and an app may request it only when an admin ticked "May receive platform-admin status" on its registration. It is true for a platform admin whose email address the platform has verified, and it is computed at each call. An absent key means false. session_expires_at is when the authorizing Dashboard session ends, or null once it is revoked or expired.
GET /api/oauth/me/groups¶
The caller's own memberships only.
POST /api/oauth/revoke¶
Form-encoded token plus the client credentials. Always 200 for an authenticated client; only that client's token is ever revoked.
GET /api/suite-apps¶
[ { "name": "Meerkat", "tagline": "Errors, logs and monitors", "launch_url": "https://…/start?prompt=none&next=/" } ]
Enabled registrations that have a launch URL, by name. The Dashboard's product switcher and account menu read this list.
Registry (/api/admin/oauth-clients, platform admin)¶
| Method and path | Does |
|---|---|
GET /api/admin/oauth-clients |
{clients: [...]} |
GET /api/admin/oauth-clients/{id} |
{client} |
POST /api/admin/oauth-clients |
register; returns {client, client_secret} — the only time the secret is shown |
PATCH /api/admin/oauth-clients/{id} |
edit name, tagline, redirect URIs, launch URL, allowed scopes; removing a scope revokes the live grants that hold it |
POST /api/admin/oauth-clients/{id}/rotate-secret |
{client, client_secret}; the previous secret works for 24 more hours. While that window is open: 409 {"code": "rotation_in_progress", "previous_expires_at": …}, unless the body is {"current_never_deployed": true}, which replaces only the current secret and keeps the previous one until its original expiry |
POST /api/admin/oauth-clients/{id}/end-previous-secret |
the previous secret stops working now; 409 {"code": "no_previous_secret"} when no window is open |
POST /api/admin/oauth-clients/{id}/disable |
ends every live token and removes the app from /api/suite-apps |
DELETE /api/admin/oauth-clients/{id} |
only a disabled registration (409 otherwise) |
Create body:
{
"name": "Meerkat",
"tagline": "Errors, logs and monitors",
"redirect_uris": ["https://appmecca-meerkat.qa.appmecca.net/api/0/auth/appmecca/callback"],
"launch_url": null,
"allowed_scopes": ["identity", "groups:read", "platform_admin"]
}
client.previous_secret_expires_at is set only while the previous secret still works.
Redirect and launch URLs must be https, with no fragment, wildcard or credentials. allowed_scopes must contain identity; the default is ["identity", "groups:read"]. Every write is in the admin audit log, and a change to allowed_scopes records the sets before and after. No response but create and rotate carries the secret.