Skip to content

Setting Up Single Sign-On

Phaset supports Single Sign-On (SSO) via OpenID Connect (OIDC), allowing your users to authenticate with their existing corporate identity provider instead of using email-based authentication.

Phaset currently supports:

  • Microsoft Azure Entra ID (formerly Azure Active Directory)
  • Google Workspace (formerly G Suite)

Before setting up SSO, ensure you have:

  • Admin access to your identity provider (Azure Entra ID or Google Workspace)
  • HTTPS enabled on your Phaset domain (required for OIDC)
  • Your Phaset instance URL (e.g., https://phaset.yourcompany.com)

Setting up SSO involves two parts:

  1. Register Phaset in your identity provider - Create an OAuth application and obtain credentials
  2. Configure Phaset with SSO settings - Add credentials to your phaset.config.json
  1. Go to the Azure Portal and navigate to Azure Active DirectoryApp Registrations.

    Click New registration and configure:

    • Name: Phaset SSO (or your preferred name)
    • Supported account types: Accounts in this organizational directory only
    • Redirect URI:
      • Platform: Web
      • URI: https://your-phaset-domain.com/auth/sso/callback/azure

    Click Register.

  2. After registration, you’ll see the application overview page. Copy these values:

    • Application (client) ID - You’ll use this as clientId
    • Directory (tenant) ID - You’ll use this as tenantId
  3. In your app registration, go to Certificates & secrets.

    Click New client secret:

    • Description: Phaset SSO Secret
    • Expires: Choose an expiration period

    Click Add.

  4. Go to API permissions in your app registration.

    Click Add a permissionMicrosoft GraphDelegated permissions.

    Add these permissions:

    • openid
    • profile
    • email

    Click Grant admin consent for [Your Organization] to approve these permissions.

  5. Add the SSO configuration to your phaset.config.json:

    {
    "sso": {
    "enabled": true,
    "provider": "azure",
    "tenantId": "your-tenant-id-from-step-2",
    "clientId": "your-client-id-from-step-2",
    "clientSecret": "your-client-secret-from-step-3",
    "redirectUri": "https://your-phaset-domain.com/auth/sso/callback/azure",
    "scopes": ["openid", "profile", "email"]
    }
    }

    Restart Phaset for changes to take effect.

Navigate to https://your-phaset-domain.com/auth/sso/azure in your browser. You should be redirected to the Microsoft login page. After authenticating with your Azure credentials, you’ll be redirected back to Phaset and logged in.

  1. Go to the Google Cloud Console.

    Select your project (or create a new one), then navigate to APIs & ServicesCredentials.

  2. If you haven’t configured the consent screen yet, click Configure Consent Screen:

    • User Type: Choose Internal (for Google Workspace users only) or External
    • App name: Phaset
    • User support email: Your support email address
    • Developer contact information: Your email address

    Under Scopes, add:

    • openid
    • profile
    • email

    Click Save and Continue through the remaining steps.

  3. Back in Credentials, click Create CredentialsOAuth 2.0 Client ID.

    Configure:

    • Application type: Web application
    • Name: Phaset SSO
    • Authorized redirect URIs: Add https://your-phaset-domain.com/auth/sso/callback/google

    Click Create.

  4. Copy these values from the credential details:

    • Client ID - You’ll use this as clientId
    • Client Secret - You’ll use this as clientSecret
  5. Add the SSO configuration to your phaset.config.json:

    {
    "sso": {
    "enabled": true,
    "provider": "google",
    "clientId": "your-client-id.apps.googleusercontent.com",
    "clientSecret": "your-client-secret",
    "redirectUri": "https://your-phaset-domain.com/auth/sso/callback/google",
    "scopes": ["openid", "profile", "email"]
    }
    }

    Restart Phaset for changes to take effect.

Navigate to https://your-phaset-domain.com/auth/sso/google in your browser. You should be redirected to the Google login page. After authenticating with your Google credentials, you’ll be redirected back to Phaset and logged in.

Like other Phaset settings, SSO can be configured via environment variables or CLI flags instead of the config file.

Azure Entra ID:

Terminal window
SSO_ENABLED=true
SSO_PROVIDER=azure
SSO_TENANT_ID=your-tenant-id
SSO_CLIENT_ID=your-client-id
SSO_CLIENT_SECRET=your-client-secret
SSO_REDIRECT_URI=https://your-phaset-domain.com/auth/sso/callback/azure
SSO_SCOPES=openid,profile,email

Google Workspace:

Terminal window
SSO_ENABLED=true
SSO_PROVIDER=google
SSO_CLIENT_ID=your-client-id.apps.googleusercontent.com
SSO_CLIENT_SECRET=your-client-secret
SSO_REDIRECT_URI=https://your-phaset-domain.com/auth/sso/callback/google
SSO_SCOPES=openid,profile,email
SSO_HOSTED_DOMAIN=yourcompany.com # Optional

When a user signs in via SSO:

  1. User is redirected to the identity provider login page
  2. User authenticates with their corporate credentials
  3. Identity provider sends authentication data back to Phaset
  4. Phaset verifies the user exists and creates a session
  5. User is logged into Phaset

Cause: The redirect URI in your identity provider doesn’t exactly match your Phaset configuration.

Solution:

  • Verify both URIs match exactly (check for trailing slashes)
  • Ensure you’re using https:// in production
  • For Azure: Check the redirect URI in Authentication settings
  • For Google: Check Authorized redirect URIs in OAuth client

Cause: The state token has expired or the user used browser back/forward buttons.

Solution:

  • State tokens expire after 5 minutes
  • Have the user restart the login process
  • Don’t use browser navigation during SSO flow

”User not found” After Successful Authentication

Section titled “”User not found” After Successful Authentication”

Cause: The user doesn’t exist in Phaset.

Solution:

  • Provision users via SCIM or manually create them
  • Verify the email address matches between identity provider and Phaset

Cause: SSO is not enabled or Phaset hasn’t restarted after configuration.

Solution:

  • Verify sso.enabled is true in your config
  • Restart Phaset: phaset start
  • Check the correct URL: /auth/sso/azure or /auth/sso/google

Cause: Azure client secrets expire based on the period you selected.

Solution:

  • Go to Certificates & secrets in Azure Portal
  • Create a new client secret
  • Update clientSecret in your Phaset configuration
  • Restart Phaset

Cause: The hostedDomain restriction is not configured.

Solution:

  • Add "hostedDomain": "yourcompany.com" to your SSO config
  • Restart Phaset
  • Domain must exactly match your Google Workspace domain

Can I use both Azure and Google SSO?

No, each Phaset deployment supports one identity provider. Choose the provider that matches your organization’s identity management system.

What happens if the identity provider goes down?

Users won’t be able to log in until the service is restored. Consider having a backup authentication method (like email-based auth) enabled for critical administrators.

Do sessions stay active if I switch identity providers?

No, existing sessions will be invalidated when you switch providers. Users will need to sign in again with the new provider.

Can I test SSO without affecting production users?

Yes, configure SSO in a test/staging Phaset instance first. Once verified, apply the same configuration to production.

How long do SSO sessions last?

Session duration is controlled by Phaset’s JWT settings (default 60 minutes, with automatic refresh). When tokens expire, users are redirected to SSO for seamless re-authentication if still logged into their identity provider.