AnkraDocs
Console

API reference · Access and identity

Identity provider sign-in

5 operations of the Ankra Cloud API: Sign-in through the OpenID Connect identity provider.

Which identity providers sign-in is available through#

GET/v1/auth/oidc
Operation
get_identity_provider_status
Credentials
None (public)

providers lists every sign-in provider in the order of their buttons (the Ankra platform's Auth0 as ankra, google, microsoft, …): the portal shows one "Continue with display_name" button per entry, with its icon mark, and above it one "Continue with …" button per entry of that provider's connections (Google, Microsoft, GitHub brokered by an Auth0 provider). Each button starts /v1/auth/oidc/login?provider=<name>. The first provider is the primary one: the top-level display_name, icon, silent_sign_in and connections describe it (for portals released before there could be several; its icon is left out when it is the Ankra mark those portals do not know), and a start without provider= goes there. Which providers exist is deployment configuration (ANKRA_CLOUD_OIDC_*), not a per-account setting.

Responses

200The provider status.application/json · IdentityProviderStatus

200 response fields
FieldTypeDescription
configuredrequiredboolean
display_namestringThe first provider's button label; present when configured.
iconstringThe mark on the first provider's "Continue with display_name" button; google when the deployment signs in with Google directly (issuer https://accounts.google.com). Absent draws none (also when the mark is the Ankra one, which providers[0].icon carries).One of google, microsoft, github, generic
silent_sign_inbooleanWhether the portal should first try a silent sign-in (prompt=none) at the first provider; true for a broker whose session the Ankra platform shares (Auth0), false for a direct provider such as Google or Microsoft.
connectionsrequiredarray of IdentityProviderConnectionThe first provider's upstream providers offered as one-click buttons, in the order ANKRA_CLOUD_OIDC_CONNECTIONS lists them; empty when none are configured or no provider is.
namerequiredstringThe provider connection name, passed as connection= to the login and sign-up routes.
display_namerequiredstring
iconrequiredstringOne of google, microsoft, github, generic
providersrequiredarray of IdentityProviderEvery sign-in provider in the order of their buttons (ANKRA_CLOUD_OIDC_PROVIDERS); the first is the primary one. Empty when no provider is configured.
namerequiredstringPassed as provider= to the login and sign-up routes.
display_namerequiredstring
iconstringThe mark on the "Continue with display_name" button; absent draws none.One of ankra, google, microsoft, github, generic
silent_sign_inrequiredbooleanWhether the portal may try a silent sign-in (prompt=none) at this provider: a broker with a session other Ankra applications share.
connectionsrequiredarray of IdentityProviderConnectionThe upstream providers this (Auth0) provider offers as one-click buttons of their own; empty for a direct provider.
namerequiredstringThe provider connection name, passed as connection= to the login and sign-up routes.
display_namerequiredstring
iconrequiredstringOne of google, microsoft, github, generic
  • defaultAny other error, usually 500.

Example

bash
curl 'https://cloud.ankra.app/v1/auth/oidc'

The identity providers' callback#

GET/v1/auth/oidc/callback
Operation
finish_identity_provider_login
Credentials
None (public)

The one callback every provider returns to. Verifies state against the ankracloud_oidc cookie, whose signed challenge alone says which provider the sign-in started at (a provider parameter naming another one is a state_mismatch), redeems code there (client secret and PKCE verifier), verifies the ID token (issuer, audience, nonce, expiry, RS256 or ES256 against the provider's keys; a Microsoft token's issuer is the one of the tenant its tid names, and the person is identified by tid and oid) and requires a verified email (Microsoft's only with the optional claim xms_edov true). Then it resolves the identity: a linked subject, a user with the same email whose own address is verified too (linked; a user whose address was never verified, such as a password sign-up, is not linked and the browser lands on /login?error=account_exists, as does any user when the provider does not vouch for the address), a pending invitation (accepted; refused with email_unverified when the provider does not vouch for the address) or a new account (whose email stays unverified when the provider does not vouch for it), sets the session cookies exactly like POST /v1/auth/login plus the ankracloud_sign_in_provider cookie sign-out reads, and answers 302 to return_to. Every failure answers 302 to /login?error=email_unverified|email_missing|state_mismatch|provider_error|provider_unavailable|account_exists&provider=<name> (email_unverified adds connection= when the sign-in named one); a silent attempt that found no provider session answers 302 to /login?silent=failed. Rate limited per client address (10 a minute).

Parameters

Parameters
NameInTypeDescription
providerquerystringNever needed; refused (as state_mismatch) when it names another provider than the signed challenge.
statequerystring
codequerystring
errorquerystring
error_descriptionquerystring

Responses

  • 302Redirect into the portal, with the session cookies set on success.
  • 429Rate limited or the email is locked out.
  • 503No capacity or address is free, or a host did not answer; try again later.
  • defaultAny other error, usually 500.

Example

bash
curl 'https://cloud.ankra.app/v1/auth/oidc/callback'

The callback of one identity provider#

GET/v1/auth/oidc/callback/{provider}
Operation
finish_identity_provider_login_at_provider
Credentials
None (public)

The callback of a provider listed in ANKRA_CLOUD_OIDC_PROVIDERS (/v1/auth/oidc/callback/ankra, /v1/auth/oidc/callback/microsoft); the provider of the single-provider variables keeps /v1/auth/oidc/callback. It behaves exactly like that route, and a path naming another provider than the signed challenge is a state_mismatch. Rate limited per client address (10 a minute).

Parameters

Parameters
NameInTypeDescription
providerrequiredpathstring
statequerystring
codequerystring
errorquerystring
error_descriptionquerystring

Responses

  • 302Redirect into the portal, with the session cookies set on success.
  • 429Rate limited or the email is locked out.
  • 503No capacity or address is free, or a host did not answer; try again later.
  • defaultAny other error, usually 500.

Example

bash
curl 'https://cloud.ankra.app/v1/auth/oidc/callback/<provider>'

Start a sign-in at the identity provider#

GET/v1/auth/oidc/login
Operation
start_identity_provider_login
Credentials
None (public)

Answers 302 to the provider's authorization endpoint (authorization code flow with state, nonce and a PKCE S256 challenge, scope openid profile email) and sets the short-lived ankracloud_oidc cookie (HttpOnly, Secure, SameSite=Lax, 10 minutes, signed) that the callback verifies. The callback goes to <portal origin>/v1/auth/oidc/callback (or /v1/auth/oidc/callback/<provider> for a provider listed in ANKRA_CLOUD_OIDC_PROVIDERS) for the configured portal origin the browser is on; the signed cookie remembers which provider the sign-in started at. Rate limited per client address (20 a minute). Not a browser-XHR endpoint: navigate to it.

Parameters

Parameters
NameInTypeDescription
return_toquerystringSame-origin path the portal lands on after sign-in; anything else becomes /dashboard.
promptquerystringnone asks the provider for a session it already has and never shows a screen (silent sign-on; a miss lands on /login?silent=failed); login forces credentials (sent to Google and Microsoft as prompt=select_account, the value they accept).
couponquerystringA coupon code redeemed for the account a sign-up creates; a value that is not shaped like a code (3 to 32 letters, digits, dashes, underscores) is dropped.
providerquerystringOne of the providers names GET /v1/auth/oidc lists (ankra, google, microsoft, …); the first provider without it. Any other name answers 400.
connectionquerystringOne of the connections names GET /v1/auth/oidc lists for the provider; forwarded to the provider's authorization endpoint so it goes straight to Google, Microsoft or GitHub. Any other name answers 400. Ignored with prompt=none.

Responses

  • 302Redirect to the provider.
  • 400The request is invalid; detail says why.
  • 429Rate limited or the email is locked out.
  • 503No capacity or address is free, or a host did not answer; try again later.
  • defaultAny other error, usually 500.

Example

bash
curl 'https://cloud.ankra.app/v1/auth/oidc/login'

Start a sign-up at the identity provider#

GET/v1/auth/oidc/signup
Operation
start_identity_provider_signup
Credentials
None (public)

Like /v1/auth/oidc/login with the provider's sign-up screen (screen_hint=signup; a direct provider such as Google has no separate sign-up screen and gets neither screen_hint nor connection). A new identity gets an account with itself as owner; a known one is simply signed in. coupon rides in the signed challenge cookie and is redeemed for the account the sign-up creates; the landing page then carries coupon_status=applied or the reason it was not applied (unknown, inactive, not_yet_valid, expired, exhausted, already_redeemed, unavailable). A sign-in of a known identity ignores it.

Parameters

Parameters
NameInTypeDescription
return_toquerystring
couponquerystringA coupon code redeemed for the account a sign-up creates; a value that is not shaped like a code (3 to 32 letters, digits, dashes, underscores) is dropped.
promptquerystring
providerquerystringOne of the providers names GET /v1/auth/oidc lists (ankra, google, microsoft, …); the first provider without it. Any other name answers 400.
connectionquerystringOne of the connections names GET /v1/auth/oidc lists for the provider; forwarded to the provider's authorization endpoint so it goes straight to Google, Microsoft or GitHub. Any other name answers 400. Ignored with prompt=none.

Responses

  • 302Redirect to the provider.
  • 400The request is invalid; detail says why.
  • 429Rate limited or the email is locked out.
  • 503No capacity or address is free, or a host did not answer; try again later.
  • defaultAny other error, usually 500.

Example

bash
curl 'https://cloud.ankra.app/v1/auth/oidc/signup'