Skip to content

Add an auth provider

POST
/instance/auth-providers
curl --request POST \
--url https://example.com/api/v1/instance/auth-providers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "slug": "example", "kind": "oidc", "display_name": "example", "enabled": true, "domains": [ "example" ], "link_by_email": true, "auto_provision": true, "issuer": "example", "client_id": "example", "client_secret": "example", "scopes": [ "example" ], "claims": { "email": "example", "name": "example", "groups": "example" }, "require_verified_email": true, "idp_metadata_url": "example", "idp_metadata_xml": "example", "sign_requests": true, "name_id_format": "unspecified" }'

Adds an identity provider members can sign in through. It vouches only for the email domains it names (domains, at least one, lowercased). The client secret is sealed and never read back. The answer carries the redirect_uri (OIDC) or the acs_url, entity_id and metadata_url (SAML) to register at the identity provider. A SAML provider’s metadata is fetched or read now, and a key pair for the instance to present to it is generated and sealed; metadata that cannot be used is 422 invalid_auth_provider (violation no_redirect_binding when the identity provider offers no HTTP-Redirect sign-on service), and one that cannot be fetched 502 provider_unreachable. Refused 422 base_url_required while the instance has no FLAGNETIC_BASE_URL, and insecure_url for an http issuer or metadata URL other than on a loopback address; private networks are allowed. A slug already in use is 409 already_exists. Audited auth_provider.created.

Media typeapplication/json

A provider of kind oidc is created from issuer, client_id, client_secret and its optional OIDC fields; one of kind saml from idp_metadata_url or idp_metadata_xml and its optional SAML fields. A field of the other kind is refused 422.

object
slug
required
string
/^[a-z][a-z0-9_-]{0,63}$/
kind
required

The protocol the provider speaks.

string
Allowed values: oidc saml
display_name
required
string
enabled

Default true.

boolean
domains
required
Array<string>
link_by_email

Default false.

boolean
auto_provision

Default false.

boolean
issuer

OIDC: https, or http on a loopback address.

string
client_id
string
client_secret
string format: password
scopes

Default openid, email and profile.

Array<string>
claims

The claims to rename; each absent one is left as it is.

object
email
string
name
string
groups
string
require_verified_email

Default true.

boolean
idp_metadata_url

SAML: where the identity provider’s metadata is fetched from, https or http on a loopback address, at most 1 MiB. Exactly one of this and idp_metadata_xml.

string
idp_metadata_xml

SAML: the identity provider’s metadata, pasted, at most 1 MiB.

string
sign_requests

SAML: whether the authentication requests are signed. Default true.

boolean
name_id_format

The format of the subject identifier requested of a SAML identity provider.

string
Allowed values: unspecified emailAddress persistent transient

The new auth provider.

Media typeapplication/json
object
id
required
string format: uuid
slug
required

Names the provider in sign-in buttons and URLs; never changes.

string
/^[a-z][a-z0-9_-]{0,63}$/
kind
required

The protocol the provider speaks.

string
Allowed values: oidc saml
display_name
required

What the sign-in button says, 1 to 200 characters.

string
enabled
required
boolean
domains
required

The email domains the provider vouches for, lowercase.

Array<string>
link_by_email
required

Whether a sign-in whose email is in domains is linked to the existing member with that email.

boolean
auto_provision
required

Whether a sign-in whose email is in domains creates its member.

boolean
issuer

The OIDC provider’s issuer URL.

string
client_id
string
client_secret_set

Whether a client secret is stored; the secret itself is never answered.

boolean
scopes
Array<string>
claims

The claims of an OIDC provider’s tokens, or the attributes of a SAML provider’s assertions, that carry what the instance reads of a person. A SAML provider reads the email from the NameID when its format is emailAddress, else from the attribute named here.

object
email
required

Default email.

string
name
required

Default name.

string
groups
required

Default groups.

string
require_verified_email

Whether a sign-in whose token does not say the email is verified is refused.

boolean
redirect_uri

OIDC only: the redirect URI to register at the identity provider, built from FLAGNETIC_BASE_URL; absent while the instance has none.

string
idp_metadata_url

SAML only: where the identity provider’s metadata is fetched from, and read again daily; absent when the metadata was pasted, which is never refreshed.

string
idp_entity_id

SAML only, read from the identity provider’s metadata.

string
idp_sso_url

SAML only: the identity provider’s HTTP-Redirect single sign-on address, read from its metadata.

string
idp_certificates

SAML only: the certificates the identity provider signs with, read from its metadata.

Array<object>

A certificate a SAML identity provider’s signatures are checked against.

object
sha256
required

The lowercase hex SHA-256 of the certificate.

string
not_after
required
string format: date-time
idp_metadata_refreshed_at

SAML only: when the identity provider’s metadata was last read, at creation, on an edit of its source or by the daily refresh.

string format: date-time
sign_requests

SAML only: whether the authentication requests are signed.

boolean
name_id_format

The format of the subject identifier requested of a SAML identity provider.

string
Allowed values: unspecified emailAddress persistent transient
acs_url

SAML only: the address the identity provider posts its responses to, built from FLAGNETIC_BASE_URL; absent while the instance has none.

string
entity_id

SAML only: the instance’s entity ID for the provider, which is its metadata address; absent while the instance has no FLAGNETIC_BASE_URL.

string
metadata_url

SAML only: where the instance serves its metadata, to import into the identity provider.

string
sp_certificates

SAML only: the certificates the instance presents, the current one and, while a rotation is pending, the next. The metadata at metadata_url lists them all.

Array<object>

A certificate the instance presents to a SAML identity provider.

object
sha256
required

The lowercase hex SHA-256 of the certificate.

string
not_after
required
string format: date-time
status
required

current signs the authentication requests; next is the certificate a pending rotation will make current.

string
Allowed values: current next
rotation_pending

SAML only: whether a certificate rotation was started and not completed.

boolean
created_at
required
string format: date-time
updated_at
required
string format: date-time
version
required
integer format: int64

Example

{
"kind": "oidc",
"name_id_format": "unspecified",
"sp_certificates": [
{
"status": "current"
}
]
}
ETag
string

The entity’s version as a strong entity tag, such as "7", to send back in If-Match.

invalid_request: a parameter that is malformed or out of its range, such as a cursor this API did not return.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

No credential, or one that is not accepted: unauthenticated without a credential (a session cookie the server did not issue counts as none); invalid_token, token_revoked or token_expired for an API token, with a WWW-Authenticate header naming the code; session_expired for a session that has ended, whose cookie is cleared; invalid_credentials for a sign-in.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}
WWW-Authenticate
string

The caller may not perform the operation: forbidden (with the missing permission), session_required, insufficient_scope, cross_origin for a request signed in by the session cookie, a read included, that the browser says comes from another origin, or, for a write, change_request_required when it would change what a protected environment’s SDKs receive; detail names those environments.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

The change conflicts with what exists, such as already_exists for a key already in use.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

The request is well formed but breaks a rule; errors names each field to fix.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}