The model
Store Ave organization IDs as workspace IDs in your app:| Concern | Source of truth |
|---|---|
| Organization membership | Ave Business |
| Member role and org scopes | Ave Business |
| Domain verification and SSO policy | Ave Business |
| App billing, projects, settings, feature flags | Your app |
| App-specific roles narrower than Ave access | Your app |
Choosing a workspace
Your app needs an Ave organization ID before it can request organization context. Common patterns:- After a normal Ave sign-in, call Ave’s organization lookup API with the returned
access_token. - Let the user create a new Ave workspace from your app with the workspace creation API.
- The organization admin links an Ave Business organization during app onboarding.
- An invite or workspace URL contains the app workspace slug, and your app maps that slug to
aveOrgId. - After a successful organization-context login, your app remembers the
org_idas a recent workspace choice.
org_id.
name, slug, and logoUrl for the picker UI. Use the returned id as organizationId when starting the organization-context login.
Create a workspace from your app
Apps can create an Ave Business workspace for the signed-in identity. Before calling the endpoint, tell the user that this creates an Ave-managed workspace and that membership, SSO, and organization access will be managed through Ave.organization.id as the workspace’s aveOrgId, then start an organization-context login with that ID before allowing workspace actions.
Sign in to a workspace
When the user chooses a workspace, start the normal PKCE flow withorganizationId.
If you use
signIn() and pass organizationId, the SDK uses the PKCE redirect flow. FedCM does not claim organization-context support.Read workspace context
After the callback, verify the token on your server and extract the workspace context./userinfo with the opaque access_token. When the token has organization context, the response includes organization, and the SDK can convert it:
Route authorization
On every workspace request:- Verify the
id_tokenfor yourclientId, or verify your own app session created from it. - Require
auth_context: "organization". - Require
org_idto match the workspace being accessed. - Check Ave org scopes for the action.
- Apply any app-local restrictions after the Ave checks pass.
access_token_jwt as a generic app route token. Its audience is Ave’s resource audience, so it is for Ave APIs and Connector token exchange.
sub claim as the acting identity ID. Use org_member_id for audit records when you want to show which organization membership authorized the action.
App-local roles
If your app has its own project roles, treat them as narrower permissions inside an Ave workspace:Revocation
When a member is removed from an Ave organization, refresh stops issuing organization-context tokens for that member. Existing short-lived tokens may remain valid until they expire. For sensitive actions, require a fresh token or an Ave signing flow. Do not cache workspace membership indefinitely in your app. Cache app metadata keyed byorg_id, but make access decisions from verified current tokens.
Server-side sessions
For dashboards that keep tokens out of the browser, use a backend session with an HttpOnly cookie and store Ave refresh tokens server-side. On each protected workspace request:- Load your app session.
- Refresh the Ave token if it is near expiry.
- If refresh returns
access_denied,invalid_grant, orenterprise_sso_required, clear the app session and send the user back through Ave. - Authorize from the freshly verified organization-context token.
Encryption and SSO
SSO proves the business identity is allowed to enter the organization. It is not an encrypted key delivery path. For standard business encryption, apps can use the organization context normally. For E2EE org mode, encrypted resources require identity-wrapped org key grants. If an SSO-created identity does not have an Ave identity encryption key and grant, it can still authenticate to the organization, but it cannot decrypt E2EE org material.Personal and business side by side
Apps can keep personal accounts and Ave Business workspaces at the same time:- No
organizationId: issue a normal personal identity session. - With
organizationId: issue an organization-context session for that Ave workspace. - Store personal resources by
sub. - Store business resources by
org_id, with audit entries includingsubandorg_member_id.
