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.
Supported Identity Providers
Section titled “Supported Identity Providers”Phaset currently supports:
- Microsoft Azure Entra ID (formerly Azure Active Directory)
- Google Workspace (formerly G Suite)
Prerequisites
Section titled “Prerequisites”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)
Configuration Overview
Section titled “Configuration Overview”Setting up SSO involves two parts:
- Register Phaset in your identity provider - Create an OAuth application and obtain credentials
- Configure Phaset with SSO settings - Add credentials to your
phaset.config.json
Azure Entra ID Setup
Section titled “Azure Entra ID Setup”-
Register Application in Azure
Section titled “Register Application in Azure”Go to the Azure Portal and navigate to Azure Active Directory → App 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
- Platform:
Click Register.
- Name:
-
Note Your Application IDs
Section titled “Note Your Application IDs”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
- Application (client) ID - You’ll use this as
-
Create Client Secret
Section titled “Create Client Secret”In your app registration, go to Certificates & secrets.
Click New client secret:
- Description:
Phaset SSO Secret - Expires: Choose an expiration period
Click Add.
- Description:
-
Configure API Permissions
Section titled “Configure API Permissions”Go to API permissions in your app registration.
Click Add a permission → Microsoft Graph → Delegated permissions.
Add these permissions:
openidprofileemail
Click Grant admin consent for [Your Organization] to approve these permissions.
-
Configure Phaset
Section titled “Configure Phaset”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.
Testing Azure SSO
Section titled “Testing Azure SSO”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.
Google Workspace Setup
Section titled “Google Workspace Setup”-
Create OAuth Client
Section titled “Create OAuth Client”Go to the Google Cloud Console.
Select your project (or create a new one), then navigate to APIs & Services → Credentials.
-
Configure OAuth Consent Screen
Section titled “Configure OAuth Consent Screen”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:
openidprofileemail
Click Save and Continue through the remaining steps.
-
Create OAuth 2.0 Client ID
Section titled “Create OAuth 2.0 Client ID”Back in Credentials, click Create Credentials → OAuth 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.
- Application type:
-
Note Your Credentials
Section titled “Note Your Credentials”Copy these values from the credential details:
- Client ID - You’ll use this as
clientId - Client Secret - You’ll use this as
clientSecret
- Client ID - You’ll use this as
-
Configure Phaset
Section titled “Configure Phaset”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.
Testing Google SSO
Section titled “Testing Google SSO”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.
Configuration Methods
Section titled “Configuration Methods”Like other Phaset settings, SSO can be configured via environment variables or CLI flags instead of the config file.
Azure Entra ID:
SSO_ENABLED=trueSSO_PROVIDER=azureSSO_TENANT_ID=your-tenant-idSSO_CLIENT_ID=your-client-idSSO_CLIENT_SECRET=your-client-secretSSO_REDIRECT_URI=https://your-phaset-domain.com/auth/sso/callback/azureSSO_SCOPES=openid,profile,emailGoogle Workspace:
SSO_ENABLED=trueSSO_PROVIDER=googleSSO_CLIENT_ID=your-client-id.apps.googleusercontent.comSSO_CLIENT_SECRET=your-client-secretSSO_REDIRECT_URI=https://your-phaset-domain.com/auth/sso/callback/googleSSO_SCOPES=openid,profile,emailSSO_HOSTED_DOMAIN=yourcompany.com # Optionalphaset start \ --ssoEnabled \ --ssoProvider azure \ --ssoTenantId your-tenant-id \ --ssoClientId your-client-id \ --ssoClientSecret your-secret \ --ssoRedirectUri https://your-phaset-domain.com/auth/sso/callback/azure \ --ssoScopes "openid,profile,email"User Management
Section titled “User Management”When a user signs in via SSO:
- User is redirected to the identity provider login page
- User authenticates with their corporate credentials
- Identity provider sends authentication data back to Phaset
- Phaset verifies the user exists and creates a session
- User is logged into Phaset
Troubleshooting
Section titled “Troubleshooting””Redirect URI mismatch” Error
Section titled “”Redirect URI mismatch” Error”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
”Invalid state parameter” Error
Section titled “”Invalid state parameter” Error”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
SSO Endpoint Returns 404
Section titled “SSO Endpoint Returns 404”Cause: SSO is not enabled or Phaset hasn’t restarted after configuration.
Solution:
- Verify
sso.enabledistruein your config - Restart Phaset:
phaset start - Check the correct URL:
/auth/sso/azureor/auth/sso/google
Client Secret Expired (Azure)
Section titled “Client Secret Expired (Azure)”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
clientSecretin your Phaset configuration - Restart Phaset
Personal Google Accounts Can Sign In
Section titled “Personal Google Accounts Can Sign In”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
Questions and Answers
Section titled “Questions and Answers”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.
Next Steps
Section titled “Next Steps”- Set up SCIM provisioning for automated user management
- Configure Phaset for production deployment
- Learn about Phaset security best practices