Skip to main content
POST/gate/idp/{provider}/authorize

Start IdP Sign-In

Starts a redirect sign-in for an end user of this project.

The page sends the origin-allowlisted redirectUri and codeChallenge, the base64url S256 of a verifier it keeps, with codeChallengeMethod S256; the response gives the identity provider's URL to send the browser to. plain is refused.

A customer page may call this cross-origin when its origin is in allowed_redirect_uris of one of the project's enabled providers.

Parameters
provider *path

The identity provider to sign in with, as configured on the project: google, github, microsoft, oidc or saml.

projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Request body
redirectUri *string

Where the end user lands after signing in with the provider.

Its origin must be on the provider configuration's allowedRedirectUris, or it must exactly equal one of its nativeRedirectUris; otherwise 403 K9O_IDP_REDIRECT_URI_NOT_ALLOWED.

The platform redirects there with #code=... in the fragment (or #error=...&error_description=...).

codeChallengestring

Required.

The PKCE challenge for a verifier your app keeps: base64url(SHA-256(verifier)), exactly 43 characters.

Send the verifier with the code to POST /@{projectSlug}/gate/idp/exchange.

Missing or malformed gets 400 K9O_INVALID_FIELD_VALUE.

codeChallengeMethodstring

Required, and must be S256. plain is refused with 400 K9O_INVALID_FIELD_VALUE.

Responses
HTTPK9O CodeDescription
200Success
400K9O_INVALID_FIELD_VALUE`codeChallenge` is missing or malformed, or `codeChallengeMethod` isn't `S256` (reason `code_challenge_required`).
Response body (200)
data *object

Where to send the end user to sign in.

authorizationUrl *string

The provider's sign-in page URL, with this sign-in's sealed state in it.

Send the browser there with a full-page navigation.

For saml it is the IdP's SSO URL with a SAML request.

The state expires after 10 minutes.

After sign-in the provider returns to the platform's callback, which redirects (302) to redirectUri with a single-use code in the fragment that expires after 60 seconds.

meta *any

Always an empty object on this route.

TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.gate.signInWithProvider('google', {
  redirectUri: 'string'
})

Showing example in TypeScript

Request example
{
  "redirectUri": "string"
}
Response example (200)
{
  "data": {
    "authorizationUrl": "string"
  }
}

More in Federation