Skip to main content

Auth0 Syndicated Authentication

When the deployment has Auth0 configured, people can sign up and sign in with a social account instead of, or in addition to, an email and password.

Two providers are supported: Google and GitHub. The sign-in, registration and profile pages show a button for each one listed in AUTH0_PROVIDERS. Any other provider is refused with 422 "The selected provider is invalid." The same feature powers email invitations and requests to join an existing organization.

Auth0 sign-in works alongside password sign-in. A password user can keep their password and also link one or more social accounts.

Prerequisites​

  • The deployment runs with OPBX_SAAS_ENABLED=true and the Auth0 variables (AUTH0_DOMAIN, AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET, AUTH0_REDIRECT_URI, AUTH0_PROVIDERS). See Auth0 Setup.
  • Without this configuration, no social buttons are shown, the Linked Accounts section of the profile is hidden, the Invite User button on the Users page is disabled (its tooltip says "Invitations need Auth0, which is not configured on this server."), and every Auth0 endpoint answers 503 with AUTH0_NOT_CONFIGURED "Auth0 is not enabled."

Permissions​

ActionOwnerPBX AdminPBX UserReporterSupervisor
Sign in with a linked social accountYesYesYesYesYes
Link or unlink their own social accountsYesYesYesYesYes
Invite a user by emailYesYesNoNoNo
List, approve or reject join requests (API)YesYesNoNoNo

Workflows​

Sign up: create a new organization​

Who can do this: anyone with a social account whose email has no OPBX account yet.

  1. Open the registration page (/ui/register).
  2. Under Or continue with, click Google or GitHub.
  3. Sign in at the provider. The provider must report the email address as verified.
  4. OPBX creates a new organization named "your email Organization", makes you its Owner, shows the toast Login successful! and opens the Dashboard. Rename the organization in your Profile.

If an OPBX account with that email already exists, nothing is created: the toast says to sign in with your password and link the account in your profile. If the social account is already linked, you are simply signed in.

Sign in with a social account​

Who can do this: any active user (every role) who linked the provider before.

  1. Open the sign-in page (/ui/login).
  2. Under Or continue with, click the provider you linked before.
  3. After the provider sign-in, OPBX finds the linked account, shows Login successful! and opens the Dashboard.

The session lasts 24 hours. What happens when the social account is not linked yet:

SituationResult
The provider's email is not verifiedAUTH0_EMAIL_UNVERIFIED: the toast Email not verified and you are back on the sign-in page. Verify the email with the provider first
An OPBX account with that email already existsAUTH0_ACCOUNT_EXISTS: sign in with your password, then link the provider in your profile
No OPBX account with that emailThe Complete your account page opens (below)
The OPBX account is inactive or pendingACCOUNT_INACTIVE "Account is not active."

Complete your account (new social users)​

Who can do this: a person who signed in with a social account that matches no OPBX user.

The Complete your account page opens by itself and offers two choices:

  • Create a new organization: click it to sign in at the provider again; OPBX then creates the organization with you as Owner (as in Sign up).
  • Request to join organization: enter the Organization slug (for example acme-corp; ask an Owner of that organization for it) and click Request to join organization. The toast says "Join request submitted. Please wait for approval." and the sign-in page opens.

The onboarding session is valid for 60 minutes and can be used for one request. When it has expired the toast says "Your sign-in session expired. Please sign in again." The slug must belong to an existing, active organization; otherwise the toast says "Failed to submit join request." If the email of the social account already belongs to an OPBX user, the toast says "The email has already been taken."

Approve or reject a join request​

Who can do this: Owner, PBX Admin (API only; there is no page for join requests).

A join request records the target organization, the person's email and name, and the social account they used.

ActionEndpointResult
List pending requestsGET /v1/organizations/join-requestsPending requests of your organization, newest first
ApprovePOST /v1/organizations/join-requests/{id}/approveCreates an active PBX User with a random password and links the social account. The person can then sign in with that provider
RejectPOST /v1/organizations/join-requests/{id}/rejectMarks the request rejected

A request that is no longer pending cannot be approved again (JOIN_REQUEST_NOT_PENDING). Approving a request whose email meanwhile belongs to a user (of any organization) is refused with a 422 on email, "The email has already been taken.", and the request stays pending. OPBX does not email the requester about the decision.

Who can do this: every signed-in user, for their own account.

  1. Sign in (with your password or an already linked provider).
  2. Open Profile from the user menu.
  3. In Linked Accounts, click Connect next to a provider (the card lists Google and Github when they are configured).
  4. Sign in at the provider with the same email address as your OPBX account (upper and lower case do not matter).
  5. You return to your profile with the toast Account linked successfully! and the provider now shows Disconnect.
ErrorMeaning
AUTH0_LINK_EMAIL_MISMATCH "Auth0 email does not match your account email."The provider account has another email. The toast Could not link account appears on your profile
AUTH0_LINK_ALREADY_LINKEDThat provider account is already linked to a user

Who can do this: every signed-in user, for their own account.

  1. Open Profile › Linked Accounts.
  2. Click Disconnect next to the provider.

The toast says "Account unlinked." and the provider shows Connect again. Your OPBX account and password stay as they are.

Profile page Linked Accounts card with the Google and Github providers, each with a Connect button (no provider linked yet)

Invite a user by email​

Who can do this: Owner, PBX Admin (needs Auth0).

  1. Open Users and click Invite User.
  2. In the Invite User dialog, enter the Email, for example colleague@example.com, and click Send Invitation.
  3. The toast Invitation sent successfully. appears. OPBX creates a pending user with the PBX User role and emails a link to /ui/invite?token=…. If the server refuses, the reason is shown in the dialog.

Rules:

  • When Auth0 is not configured, the Invite User button is disabled.
  • The link is valid for 24 hours (OPBX_INVITE_TOKEN_TTL_HOURS) and can be used once.
  • Inviting an email that is still pending sends a new link; the old one stops working.
  • Inviting an email that already belongs to a user of your organization is refused: "A user with this email already exists in the organization." An email that belongs to a user of another organization is refused with "The email has already been taken." (an email can belong to one organization only).
  • Each organization can send at most 10 invitations per hour (OPBX_INVITE_RATE_LIMIT_PER_HOUR): "Invitation rate limit exceeded. Please try again later."
  • Change the invited user's role afterwards on the Users page if PBX User is not right.
Invite User dialog on the Users page with the email colleague@example.com entered and the Send Invitation button

Accept an invitation​

Who can do this: the invited person.

  1. Open the link from the invitation email. The page says "You're invited" and "Join organization on OPBX."
  2. Click Accept & Continue and sign in at the first configured provider, with the invited email filled in.
  3. If the provider's email is verified and matches the invitation, the user becomes active, the toast Login successful! appears and the Dashboard opens.
Invitation errorMeaning
INVITE_EXPIRED_OR_INVALID "Invitation is invalid or has expired."The link is wrong, expired or already used. The page shows Invitation Error with Go to Login
INVITE_INVALID_USERThe invited user was already activated
INVITE_EMAIL_MISMATCHThe provider account's email is not the invited email (toast Invitation email mismatch)
AUTH0_EMAIL_UNVERIFIEDThe provider did not confirm the email

Other errors​

CodeCauseWhat to do
AUTH0_NOT_CONFIGUREDAuth0 is not enabled or no provider is configuredConfigure Auth0 (see Prerequisites)
AUTH0_INVALID_PROVIDERThe provider is not in AUTH0_PROVIDERSUse a configured provider
AUTH0_INVALID_STATEThe sign-in attempt expired or the callback was reusedStart the sign-in again
AUTH0_INVALID_CALLBACKThe callback is missing its code or stateStart the sign-in again
AUTH0_RESOLUTION_FAILEDUnexpected error while matching the accountCheck the logs

Key data fields​

user_social_identities​

ColumnNotes
user_idThe OPBX user
providergoogle or github
provider_subjectThe provider's user id
provider_emailEmail returned by the provider when linked
provider_dataExtra provider details

organization_join_requests​

ColumnNotes
organization_idTarget organization
email, nameThe requester
provider, provider_subjectThe social account used
statuspending, approved or rejected
MethodEndpointPurpose
POST/v1/auth/auth0/redirectStart a sign-in (provider, intent)
GET/v1/auth/auth0/callbackFinish the sign-in
POST/v1/auth/auth0/linkStart linking a provider (signed in)
POST/v1/auth/auth0/unlinkUnlink a provider (signed in)
POST/v1/users/inviteInvite by email (Owner, PBX Admin; needs Auth0)
GET/v1/users/invite/validateCheck an invitation link
POST/v1/users/invite/acceptAccept and get the Auth0 sign-in URL
POST/v1/organizations/join-requestsSubmit a join request (onboarding)
GET/v1/organizations/join-requestsPending requests
POST/v1/organizations/join-requests/{id}/approveApprove
POST/v1/organizations/join-requests/{id}/rejectReject

See the OPBX REST API reference for full schemas.

  • Users — the Invite User button and roles
  • Profile — Linked Accounts
  • Auth0 Setup — tenant and environment configuration