Sign-in and access
Browser sign-in in AOS
Section titled “Browser sign-in in AOS”AOS browser sign-in uses configured NextAuth providers plus a credentials flow and an email code flow used for password reset. Providers are only added when the required environment variables are set, so available sign-in methods depend on deployment configuration.
Supported provider integrations in code include credentials, email, custom OIDC-style SSO, Google, Okta, Authentik, OneLogin, Auth0, GitHub, GitHub Enterprise, GitLab, Azure AD, Cognito, Keycloak, JumpCloud, WorkOS, and WordPress. Some providers also support explicit account-linking flags such as AUTH_*_ALLOW_ACCOUNT_LINKING === "true".
Important behavior:
- Email and password sign-in can be disabled for the whole instance or enforced off for a domain, in which case users are told to use SSO.
- If a user record has no local password, credentials sign-in is refused and the user is told to sign in with a linked identity provider.
- Deactivated accounts cannot sign in by credentials, SSO, or email code.
- Sign-in policy evaluation applies across provider types and can redirect denied sign-ins to
/auth/sign-in?error=CODE. - Google sign-in can optionally restrict allowed hosted domains when configured.
Defaults and ceilings:
- Browser sessions use JWT strategy.
- Session max age is
AUTH_SESSION_MAX_AGE * 60seconds. - Email verification tokens for the email provider expire after 3 minutes.
Example deployment-configured provider patterns:
Credentials: always registeredEmail: always registered for password reset flowGoogle: requires AUTH_GOOGLE_CLIENT_ID and AUTH_GOOGLE_CLIENT_SECRETOkta: requires AUTH_OKTA_CLIENT_ID, AUTH_OKTA_CLIENT_SECRET, AUTH_OKTA_ISSUERCustom SSO: requires AUTH_CUSTOM_CLIENT_ID, AUTH_CUSTOM_CLIENT_SECRET, AUTH_CUSTOM_ISSUER, AUTH_CUSTOM_NAMEThis documentation does not assume which of these providers are enabled in any deployment.
Membership and built-in roles
Section titled “Membership and built-in roles”Membership and roles are separate from browser sign-in. Signing in creates or accesses an identity, while organization and project membership determine what that user can do.
Built-in roles shown in the role guide are:
OWNERADMINMEMBERVIEWERPROMPT_EDITORCMS_EDITORTALK_USERNONE
Role meaning in AOS:
- Organization role controls organization administration and the default role in that organization’s projects.
- Only organization Owners and Admins can create new projects.
- Project role applies to one existing project only.
- Project role does not grant organization administration or permission to create other projects.
- Project role
NONEkeeps the organization default for that project. - Instance administrator is a separate installation-wide role.
Selected built-in permission examples exposed by the role guide:
- Organization role table checks
projects:createandorganizationMembers:CUD. - Project role table checks
prompts:CUD,cms:CUD, andtalk:use.
The session payload also carries organization memberships, project memberships, resolved project roles, and effective scope lists. Projects are only included in the session when the user has project:read.
How role granting is constrained
Section titled “How role granting is constrained”AOS prevents role and permission escalation when users grant roles or manage memberships.
Granting rule:
- A grant has a
levelandscopes. - A user may grant or manage a role only when the target level is less than or equal to their effective level.
- The user must also already hold every scope they are trying to grant in the relevant namespace.
- For project scope checks, only project-relevant scopes are considered.
- Instance admins are unrestricted by this check.
Authority source:
- AOS reads the acting user’s authority from Postgres, not from session data, so recently demoted users do not keep grant power due to stale session cache.
- For project operations, authority uses the higher of the user’s organization and project membership levels, with scopes unioned.
Typical denial messages include:
You cannot grant/edit a role higher than your ownYou cannot grant permissions you do not hold: ...
This means sign-in alone never authorizes role administration; actual membership and scope authority do.
Project and organization API keys
Section titled “Project and organization API keys”AOS API keys are separate credentials from browser sign-in and membership sessions.
Key format and storage behavior:
- A generated key set contains a public key prefixed
pk-ao-and a secret key prefixedsk-ao-. - The displayed secret value is shortened to the first 6 characters,
..., and the last 4 characters. - Secret keys are stored hashed with bcrypt.
- A second SHA-256 based hash is also stored using the secret key and
SALT. - Key creation fails if
SALTis not set.
Scopes and binding:
- Keys are created with
ApiKeyScopeand bound to either a project or an organization. - Project-scoped keys store
projectId; organization-scoped keys storeorgId. - A project key can also be bound to an extension installation with
installationId.
Optional configuration at creation time:
notecapabilities, which default to full access[*]when omittedcreatedByUserIdinstallationIdfor project keys- predefined public and secret keys instead of generated ones
Returned values from creation include the new key id, creation time, note, public key, full secret key, display secret key, and capabilities.
These are internal key-creation and storage details, not a public SDK method. Integrations should use the supported API key management workflow, not call database helpers directly. Store the returned secret securely when creating a key; the stored hashes and display value cannot be used to recover it. Use a restricted capability set when full access is unnecessary.
How these three layers relate
Section titled “How these three layers relate”AOS keeps browser sign-in, membership/roles, and API keys distinct:
- Browser sign-in authenticates a person into a session using configured providers or credentials.
- Membership and roles determine organization and project access within that signed-in session.
- API keys are separate non-browser credentials tied to an organization or project record, not to a browser session.
Examples from the code:
- SSO sign-in can create an identity, and invitation or group mapping grants access later.
- Session user data is enriched with organization memberships, project roles, scopes, plans, and entitlements.
- API keys are created independently with their own scope and hashing pipeline.
Practical implication for documentation and integrations:
- Do not treat successful browser sign-in as proof that a user has project access.
- Do not treat project membership as an API key.
- Do not assume provider availability, account-linking behavior, or deployed identity provider choice without deployment-specific configuration evidence.