auth library
Classes
- AuthErrors
- AuthResult
- AuthStatus
- ChangePasswordDto
- FetchQuery
- ForgotPasswordDto
- LoginDto
- Message
-
The
{"message": "..."}body the password-reset endpoints answer with. - Operator
- OrderDirection
- RegisterDto
- ResetPasswordDto
- SsoCallbackError
- Sign-in failed before the app regained control.
- SsoCallbackExchange
- Sign-in produced a one-time code to exchange for tokens.
- SsoCallbackNone
- No SSO parameters were present at all.
- SsoCallbackOutcome
- What the query parameters on an SSO callback URL turned out to mean.
- SsoLinkDto
-
Request body for
POST /api/auth/oauth/link. - SsoLoginOptions
- Optional settings for SSO sign-in.
- SsoProviderInfo
-
A provider as reported by
GET /api/auth/oauth/providers. - Tokens
- The pair every sign-in path returns: a short-lived access token, and the refresh token that renews it.
- TwoFactorAuthDto
- User
-
The signed-in user, as
/api/auth/sessionand the user endpoints return them.
Enums
- SSO
- Single sign-on providers supported by the Appstrax Auth API.
Constants
-
empty
→ const Map<
String, dynamic> - ssoCallbackPath → const String
- Path, relative to the API URL, that the Appstrax API serves for native apps.
- ssoLinkRequiredStatus → const String
- Status the API reports when the Google account's email already belongs to a password account, so the user has to prove ownership before it is linked.
Properties
- appstraxAuth → AppstraxAuth
-
The auth service. Final: the class is already a singleton behind its
factory constructor, and a reassignable top-level variable only undermined
that guarantee.
final
Functions
-
defaultSsoRedirectUri(
String apiUrl) → String -
The default return URL for SSO:
{apiUrl}/sso-callback. -
parseSsoProviders(
dynamic json) → List< SsoProviderInfo> -
Reads the body of
GET /api/auth/oauth/providers. -
resolveSsoCallbackParams(
{String? code, String? status, String? error}) → SsoCallbackOutcome - Interprets the query parameters the API redirects back with.
-
validateAuthorizationUrl(
dynamic authorizationUrl) → String - Checks the URL the API told us to open before it is handed to the system browser.
-
validateSsoRedirectUri(
String redirectUri) → void - Rejects redirect URIs the API would refuse, so a misconfigured app fails with a clear message here instead of an opaque error from the server.
Exceptions / Errors
- AlreadyAuthenticatedException
- A two factor code was submitted for a session that is already complete.
- AppstraxException
- Base for the errors this SDK raises for an application to act on.
- LoginRequiredException
- A two factor code was submitted before any sign-in was started.
- MissingSsoLinkTokenException
- AppstraxAuth.linkSsoAccount was called without a pending link token, usually because the ten minute window elapsed or the app restarted.
- NotAuthenticatedException
- No session, or one that can no longer be refreshed. Sign in again.
- SsoCallbackMismatchException
- Thrown when the provider returns to somewhere other than the expected URL.
- SsoCancelledException
- Thrown when the user dismisses the sign-in sheet without completing it.
- SsoRedirectException
- The provider returned something the SDK could not use.
- TokenExpiredException
- The access token has expired and could not be renewed.