Create Login Flow for Browsers
GEThttps://accounts.<domain>/auth/self-service/login/browser
This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows.
If this endpoint is opened as a link in the browser, it will be redirected to
selfservice.flows.login.ui_url
with the flow ID set as the query parameter ?flow=
. If a valid user session
exists already, the browser will be redirected to urls.default_redirect_url
unless the query parameter
?refresh=true
was set.
If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the
case of an error, the error.id
of the JSON response body can be one of:
session_already_available
: The user is already signed in.
session_aal1_required
: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet.
security_csrf_violation
: Unable to fetch the flow because a CSRF violation occurred.
security_identity_mismatch
: The requested ?return_to
address is not allowed to be used. Adjust this in the configuration!
This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed.
Request
Query Parameters
Refresh a login session
If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session.
Request a Specific AuthenticationMethod Assurance Level
Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to "upgrade" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to "aal2".
The URL to return the browser to after the flow was completed.
An optional login challenge.
The value for this parameter comes from login_challenge
URL Query parameter sent to your
application (e.g. /login?login_challenge=abcde
).
An optional organization ID that should be used for logging this user in.
Header Parameters
HTTP Cookies
When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
Responses
- 200
- 303
- 400
- default
loginFlow
- application/json
- Schema
- Example (from schema)
Schema
Possible values: [password
, totp
, oidc
, webauthn
, lookup_secret
, code
]
and so on.
CreatedAt is a helper struct field for gobuffalo.pop.
ExpiresAt is the time (UTC) when the flow expires. If the user still wishes to log in, a new flow has to be initiated.
ID represents the flow's unique ID. When performing the login flow, this represents the id in the login UI's query parameter: http://<selfservice.flows.login.ui_url>/?flow=<flow_id>
IssuedAt is the time (UTC) when the flow started.
OAuth 2.0 Login Challenge.
This value is set using the login_challenge
query parameter of the registration and login endpoints.
If set will cooperate with OAuth2 and OpenID to act as an OAuth2 server / OpenID Provider.
oauth2_login_request object
Refresh stores whether this login flow should enforce re-authentication.
RequestURL is the initial URL that was requested. It can be used to forward information contained in the URL's path or query for example.
Possible values: [aal0
, aal1
, aal2
, aal3
]
The authenticator assurance level can be one of "aal1", "aal2", or "aal3". A higher number means that it is harder for an attacker to compromise the account.
Generally, "aal1" implies that one authentication factor was used while AAL2 implies that two factors (e.g. password + TOTP) have been used.
ReturnTo contains the requested return_to URL.
SessionTokenExchangeCode holds the secret code that the client can use to retrieve a session token after the login flow has been completed. This is only set if the client has requested a session token exchange code, and if the flow is of type "api", and only on creating the login flow.
State represents the state of this request:
choose_method: ask the user to choose a method to sign in with sent_email: the email has been sent to the user passed_challenge: the request was successful and the login challenge was passed.
The flow type can either be api
or browser
.
ui objectrequired
UpdatedAt is a helper struct field for gobuffalo.pop.
{
"active": "password",
"created_at": "2025-04-17T12:10:30.806Z",
"expires_at": "2025-04-17T12:10:30.806Z",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"issued_at": "2025-04-17T12:10:30.806Z",
"oauth2_login_challenge": "string",
"oauth2_login_request": {
"AdditionalProperties": {},
"challenge": "string",
"client": {
"AdditionalProperties": {},
"access_token_strategy": "string",
"allowed_cors_origins": [
"string"
],
"audience": [
"string"
],
"authorization_code_grant_access_token_lifespan": "string",
"authorization_code_grant_id_token_lifespan": "string",
"authorization_code_grant_refresh_token_lifespan": "string",
"backchannel_logout_session_required": true,
"backchannel_logout_uri": "string",
"client_credentials_grant_access_token_lifespan": "string",
"client_id": "string",
"client_name": "string",
"client_secret": "string",
"client_secret_expires_at": 0,
"client_uri": "string",
"contacts": [
"string"
],
"created_at": "2025-04-17T12:10:30.806Z",
"frontchannel_logout_session_required": true,
"frontchannel_logout_uri": "string",
"grant_types": [
"string"
],
"implicit_grant_access_token_lifespan": "string",
"implicit_grant_id_token_lifespan": "string",
"jwks_uri": "string",
"jwt_bearer_grant_access_token_lifespan": "string",
"logo_uri": "string",
"metadata": {},
"owner": "string",
"policy_uri": "string",
"post_logout_redirect_uris": [
"string"
],
"redirect_uris": [
"string"
],
"refresh_token_grant_access_token_lifespan": "string",
"refresh_token_grant_id_token_lifespan": "string",
"refresh_token_grant_refresh_token_lifespan": "string",
"registration_access_token": "string",
"registration_client_uri": "string",
"request_object_signing_alg": "string",
"request_uris": [
"string"
],
"response_types": [
"string"
],
"scope": "string",
"sector_identifier_uri": "string",
"skip_consent": true,
"subject_type": "string",
"token_endpoint_auth_method": "string",
"token_endpoint_auth_signing_alg": "string",
"tos_uri": "string",
"updated_at": "2025-04-17T12:10:30.806Z",
"userinfo_signed_response_alg": "string"
},
"oidc_context": {
"AdditionalProperties": {},
"acr_values": [
"string"
],
"display": "string",
"id_token_hint_claims": {},
"login_hint": "string",
"ui_locales": [
"string"
]
},
"request_url": "string",
"requested_access_token_audience": [
"string"
],
"requested_scope": [
"string"
],
"session_id": "string",
"skip": true,
"subject": "string"
},
"organization_id": "string",
"refresh": true,
"request_url": "string",
"requested_aal": "aal0",
"return_to": "string",
"session_token_exchange_code": "string",
"type": "string",
"ui": {
"action": "string",
"messages": [
{
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
],
"method": "string",
"nodes": [
{
"attributes": {},
"group": "default",
"messages": [
{
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
],
"meta": {
"label": {
"context": {},
"id": 0,
"text": "string",
"type": "info"
}
},
"type": "text"
}
]
},
"updated_at": "2025-04-17T12:10:30.807Z"
}
Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201.
errorGeneric
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 404,
"debug": "SQL field \"foo\" is not a bool.",
"details": {},
"id": "string",
"message": "The resource could not be found",
"reason": "User with ID 1234 does not exist.",
"request": "d7ef54b1-ec15-46e6-bccb-524b82c035e6",
"status": "Not Found"
}
}
errorGeneric
- application/json
- Schema
- Example (from schema)
Schema
error objectrequired
{
"error": {
"code": 404,
"debug": "SQL field \"foo\" is not a bool.",
"details": {},
"id": "string",
"message": "The resource could not be found",
"reason": "User with ID 1234 does not exist.",
"request": "d7ef54b1-ec15-46e6-bccb-524b82c035e6",
"status": "Not Found"
}
}
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X GET 'https://connhex.com/auth/self-service/login/browser' \
-H 'Accept: application/json'