Skip to content

In-App Sign-In (Beta)

With in-app sign-in, your app shows its own login screens and sends what the user types to AuthAction. You get an authorization code, and exchange it at the token endpoint as usual. No browser opens.

It follows the IETF draft OAuth 2.0 for First-Party Applications (draft 04).

Sign-inWhere it happens
Email and passwordYour screens
Emailed codeYour screens
Verifying an email address after passwordYour screens
Choosing an organizationYour screens
Social, SAML and other identity providersThe browser (redirect_to_web, or a web button)
Sign-up, password reset and passkeysThe browser

In the dashboard, open the application and turn on Authentication policy > In-app sign-in. With the Management API, set firstPartyLogin to true on PATCH /api/v1/applications/{id}.

Application typeWhat it must send
Native (native)A PKCE code_challenge on the first request. Create this type with the Management API.
Single-page (spa)Its client_secret on every request. Call it from your backend. Never put the secret in the browser.
Any other typeNot allowed: unauthorized_client
Terminal window
curl https://your-tenant.eu.authaction.com/oauth2/authorize-challenge \
-d client_id=YOUR_CLIENT_ID \
-d response_type=code \
-d username=alice@example.com \
-d code_challenge=YOUR_CODE_CHALLENGE \
-d code_challenge_method=S256

When more is needed, the answer is 403 with an auth_session:

{
"error": "insufficient_authorization",
"auth_session": "q0nX...",
"method_required": true,
"methods": ["password", "email_code"]
}

Send auth_session on every following request. It lasts 15 minutes and gives one code.

The first request also takes scope, audience (or resource), nonce, organization and ui_locales. There is no redirect_uri. You can send username and password on the first request to finish in one step.

The answer says what to send next:

In the answerSend
username_requiredusername (an email address)
method_requiredpassword, or method=email_code
password_requiredpassword
otp_requiredotp. otp_purpose is sign_in or verify_email. Send method=email_code for a new code.
organization_requiredorganization: an id or name from organizations

For example:

Terminal window
curl https://your-tenant.eu.authaction.com/oauth2/authorize-challenge \
-d auth_session=q0nX... \
-d method=email_code
curl https://your-tenant.eu.authaction.com/oauth2/authorize-challenge \
-d auth_session=q0nX... \
-d otp=123456

A finished sign-in answers 200:

{ "authorization_code": "Xk3v..." }

Exchange it without a redirect_uri:

Terminal window
curl https://your-tenant.eu.authaction.com/oauth2/token \
-d grant_type=authorization_code \
-d client_id=YOUR_CLIENT_ID \
-d code=Xk3v... \
-d code_verifier=YOUR_CODE_VERIFIER

A backend sends client_secret in place of code_verifier.

errorStatusWhat to do
invalid_credentials400Wrong email or password. Ask again.
invalid_otp400Wrong or expired code. Ask again, or send a new one.
invalid_session400Expired, used, or too many tries. Start again without auth_session.
redirect_to_web403Open the hosted login page with a normal authorize request.
access_denied403The user is blocked, or not a member of the organization.
invalid_client401Unknown client_id, or a missing or wrong client_secret.
unauthorized_client400In-app sign-in is off, or the application type is not allowed.
invalid_request400A field is missing or wrong. Read error_description.
temporarily_unavailable429Too many requests from one IP address. Wait a minute.

Your app must always handle redirect_to_web. When an address belongs to an organization with its own identity provider, the answer also names the connection and organization. Pass both to /oauth2/authorize.

  • 5 passwords or codes per auth_session.
  • 10 wrong passwords in a row per email address in 15 minutes, then redirect_to_web.
  • 5 emailed codes per email address in 15 minutes, then redirect_to_web.
  • Native apps are also limited by IP address.

An address without an account gets the same answers as one that has an account. No consent page is shown.