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).
What it supports
Section titled “What it supports”| Sign-in | Where it happens |
|---|---|
| Email and password | Your screens |
| Emailed code | Your screens |
| Verifying an email address after password | Your screens |
| Choosing an organization | Your screens |
| Social, SAML and other identity providers | The browser (redirect_to_web, or a web button) |
| Sign-up, password reset and passkeys | The browser |
Turn it on
Section titled “Turn it on”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 type | What 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 type | Not allowed: unauthorized_client |
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=S256When 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.
Continue
Section titled “Continue”The answer says what to send next:
| In the answer | Send |
|---|---|
username_required | username (an email address) |
method_required | password, or method=email_code |
password_required | password |
otp_required | otp. otp_purpose is sign_in or verify_email. Send method=email_code for a new code. |
organization_required | organization: an id or name from organizations |
For example:
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=123456Get tokens
Section titled “Get tokens”A finished sign-in answers 200:
{ "authorization_code": "Xk3v..." }Exchange it without a redirect_uri:
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_VERIFIERA backend sends client_secret in place of code_verifier.
Errors
Section titled “Errors”error | Status | What to do |
|---|---|---|
invalid_credentials | 400 | Wrong email or password. Ask again. |
invalid_otp | 400 | Wrong or expired code. Ask again, or send a new one. |
invalid_session | 400 | Expired, used, or too many tries. Start again without auth_session. |
redirect_to_web | 403 | Open the hosted login page with a normal authorize request. |
access_denied | 403 | The user is blocked, or not a member of the organization. |
invalid_client | 401 | Unknown client_id, or a missing or wrong client_secret. |
unauthorized_client | 400 | In-app sign-in is off, or the application type is not allowed. |
invalid_request | 400 | A field is missing or wrong. Read error_description. |
temporarily_unavailable | 429 | Too 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.
Limits
Section titled “Limits”- 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.