/api/oauth2

OAuth2 / OpenID Connect authorization endpoint (RFC 6749 §3.1). This is where the browser web-app logs a user in. It authenticates the end user — by password (auth_method=easydb, the default; also ldap, email, collection), anonymously (anonymous, when guest login is enabled), via SAML, or with an action code — and returns an authorization response (an authorization code, token or id_token) by redirecting back to the client's redirect_uri.

Served at /api/oauth2/authnot under /api/v1. No prior access token is required.

GET /oauth2/auth — Begin an authorization request (interactive login).

Begin an authorization request (interactive login).

get
Query parameters
client_idstringRequired

The OAuth2 client identifier.

response_typestring · enumRequired

The OAuth2/OIDC response type. Combined types such as code id_token are also supported.

Possible values:
redirect_uristring · uriOptional

Where to redirect with the result. Must match the client registration.

scopestringOptional

Space-separated scopes, within the client's allowed set (a client that configures none may use all of read, write, openid, offline). Their effect in fylr:

  • openid — also issue an OpenID Connect id_token (an RS256 JWT) alongside the access token. (The /api/oauth2/userinfo endpoint itself accepts any valid access token and is not gated on this scope.)
  • offline — request a refresh token. A refresh token is issued (for the authorization-code and password grants) only when this scope is granted, and granting it also applies the configured refresh-token expiration override. fylr accepts both offline and the OIDC-standard offline_access for this.
  • read, write — capability labels only; they are not consulted to authorize API calls. Actual API authorization uses fylr's per-user/per-pool ACL rights, which are independent of these OAuth2 scopes despite the matching names.
statestringOptional

Opaque value echoed back to the client.

code_challengestringOptional

PKCE code challenge.

code_challenge_methodstring · enumOptionalPossible values:
auth_methodstring · enumOptional

fylr login method (default easydb). The endpoint accepts a comma-separated list and tries the methods in order; the web-app sends a single value. Each method authenticates a specific user type:

  • easydblogin + password against the fylr user database (user types easydb, system, easydb_self_register). Also the fallback when auth_method is set to an unrecognised value. (An empty auth_method parses to auto, not easydb.)
  • ldaplogin + password bound against a configured LDAP directory; provisions/updates an ldap user. Only available when an LDAP connection is configured and the license permits external auth.
  • email — passwordless login for invited email users: login plus the account UUID (sent in the password field) — the UUID is the secret.
  • collectionlogin + password for collection user accounts.
  • saml — SAML 2.0 SSO; no credentials in the form. The first call redirects to the IdP, then the returned assertion provisions/updates an sso user. Only available when SAML is configured and the license permits external auth.
  • action_code — a one-time secret + action_code pair used by internal redirect flows (forced password change, system messages); logs in whichever user the code was issued for. Single-use.
  • anonymous — guest login, no credentials; binds to a per-browser anonymous user. Only when guest login is enabled (base config guest).
  • auto — server-side selector (the web-app default): resolves to anonymous when guests are allowed and no login is supplied, otherwise to password login (easydb, then ldap when configured).
Default: easydbPossible values:
loginstringOptional

User login (for password methods).

passwordstringOptional

User password (for password methods).

Responses

POST /oauth2/auth — Submit the login form / authorization request.

Submit the login form / authorization request.

post

Same as GET, but the parameters are sent as an application/x-www-form-urlencoded body — used when the login form is submitted.

Body
client_idstringOptional
response_typestringOptional
redirect_uristring · uriOptional
scopestringOptional
statestringOptional
auth_methodstring · enumOptionalPossible values:
loginstringOptional
passwordstringOptional
secretstringOptional

Action-code secret (for auth_method=action_code).

action_codestringOptional
Responses

POST /oauth2/token — Issue an access token.

Issue an access token.

post

application/x-www-form-urlencoded request. Confidential clients authenticate with client_id/client_secret (form fields or HTTP Basic); public clients send only client_id. For the resource-owner password grant fylr validates username/password against the easydb, collection, email, then LDAP login methods in turn.

Body
grant_typestring · enumRequiredPossible values:
codestringOptional

Authorization code (grant_type=authorization_code).

redirect_uristring · uriOptional
refresh_tokenstringOptional

Refresh token (grant_type=refresh_token).

usernamestringOptional

Resource-owner login (grant_type=password).

passwordstringOptional

Resource-owner password (grant_type=password).

scopestringOptional

Space-separated scopes.

client_idstringOptional
client_secretstringOptional
code_verifierstringOptional

PKCE code verifier.

Responses

POST /oauth2/revoke — Revoke a token (logout).

Revoke a token (logout).

post
Body
tokenstringRequired

The access or refresh token to revoke.

token_type_hintstring · enumOptionalPossible values:
client_idstringOptional
client_secretstringOptional
Responses
200

The token was revoked (also returned for an unknown token).

No content

POST /oauth2/introspect — Introspect a token.

Introspect a token.

post
Body
tokenstringRequired
token_type_hintstring · enumOptionalPossible values:
Responses
200

Introspection result. active is false for an unknown, expired or revoked token; the other fields are present only when the token is active.

GET /oauth2/userinfo — Get claims for the access-token user.

Get claims for the access-token user.

get
Authorizations
AuthorizationstringRequired

Access token in the Authorization header: Authorization: Bearer <token>.

Responses

POST /oauth2/userinfo — Get claims for the access-token user (form POST).

Get claims for the access-token user (form POST).

post
Authorizations
AuthorizationstringRequired

Access token in the Authorization header: Authorization: Bearer <token>.

Responses
200

The user's OpenID claims.

Last updated