Single Sign-On — Azure AD & Google
Single Sign-On (SSO) allows employees to log in to Udyamo HRMS using their existing organizational credentials — either a Google Workspace account or a Microsoft Azure Active Directory (Azure AD) account. SSO simplifies the login experience, improves security through centralized authentication, and reduces password fatigue for employees.
This chapter covers how SSO works in Udyamo HRMS, how to configure Google OAuth2 and Azure AD SSO, and how employees use SSO to log in.
What You Will Learn
- What Single Sign-On is and its benefits
- How Google OAuth2 SSO works in Udyamo HRMS
- How Azure AD SSO works for Microsoft 365 organizations
- How to configure each SSO provider (admin setup)
- The employee login flow for each SSO method
- How SSO interacts with existing password-based accounts
- Troubleshooting common SSO issues
Prerequisites
Required: You must have an Administrator role to configure SSO providers.
Required: For Google OAuth2: A Google Workspace organization with admin access to the Google Cloud Console.
Required: For Azure AD: A Microsoft 365 / Azure AD tenant with admin access to the Azure Portal.
What Is Single Sign-On?
Single Sign-On is an authentication mechanism that allows users to log in to multiple applications using a single set of credentials managed by an identity provider (IdP). Instead of maintaining a separate username and password for Udyamo HRMS, employees use their Google or Microsoft account.
Benefits of SSO
| Benefit | Description |
|---|---|
| Simplified login | Employees use one set of credentials for multiple applications |
| Reduced password fatigue | Fewer passwords to remember means fewer weak or reused passwords |
| Centralized access control | IT admins manage access from one identity provider (Google Admin, Azure AD) |
| Automatic deprovisioning | When an employee is removed from Google Workspace or Azure AD, they lose access to Udyamo HRMS |
| Stronger security | Leverages the IdP's security features — MFA, conditional access, session management |
| Compliance | Audit trails from the IdP complement Udyamo HRMS's own logging |
SSO Architecture Overview
Udyamo HRMS implements SSO through the OmniauthCallbacksController, which handles the OAuth2/OpenID Connect flow for both Google and Azure AD.
Authentication Flow
- Employee clicks Sign in with Google or Sign in with Microsoft on the login page.
- Udyamo HRMS redirects the employee to the identity provider's login page.
- The employee enters their Google or Microsoft credentials (and completes MFA if required by their organization).
- The identity provider authenticates the user and redirects back to Udyamo HRMS with an authorization token.
- Udyamo HRMS verifies the token and matches the user's email address to an existing employee record.
- If a match is found, the employee is logged in. If no match is found, the login is rejected.

Warning: SSO login requires that the email address in the identity provider matches the email registered in Udyamo HRMS. If an employee's Google or Microsoft email differs from their Udyamo HRMS email, SSO login will fail.
Google OAuth2 SSO
Google OAuth2 SSO is ideal for organizations that use Google Workspace (formerly G Suite) for email and productivity tools.
Admin Setup: Configuring Google OAuth2
To configure Google OAuth2, you need to create an OAuth2 client in the Google Cloud Console and then enter the credentials in Udyamo HRMS.
Step 1: Create a Google Cloud OAuth2 Client
- Log in to the Google Cloud Console.
- Select your project (or create a new one).
- Navigate to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID.
- Select Web application as the application type.
- Configure the following:
| Field | Value |
|---|---|
| Name | Udyamo HRMS SSO |
| Authorized redirect URIs | https://your-domain.udyamo.com/users/auth/google_oauth2/callback |
- Click Create.
- Note the Client ID and Client Secret — you will need these in the next step.
Warning: Keep the Client Secret confidential. Do not share it in emails, chat messages, or public repositories.
Step 2: Configure Google OAuth2 in Udyamo HRMS
- Log in to Udyamo HRMS as an administrator.
- Navigate to Settings > Security > Single Sign-On.
- In the Google OAuth2 section, click Configure.
- Enter the following:
| Field | Description | Required |
|---|---|---|
| Client ID | The OAuth2 Client ID from Google Cloud Console | Yes |
| Client Secret | The OAuth2 Client Secret from Google Cloud Console | Yes |
| Allowed Domain(s) | Restrict SSO to specific email domains (e.g., yourcompany.com). Leave blank to allow any Google account. | Recommended |
- Click Save.
- Toggle Enable Google SSO to on.

Tip: Restricting to your company's email domain prevents external Google accounts from attempting to log in. This is strongly recommended for security.
Step 3: Test Google SSO
- Open an incognito/private browser window.
- Navigate to the Udyamo HRMS login page.
- Click Sign in with Google.
- Select a Google Workspace account that matches an employee email in Udyamo HRMS.
- Verify that you are successfully logged in.
Employee Login Flow: Google
- Navigate to the Udyamo HRMS login page.
- Click Sign in with Google.
- If not already signed in to Google, enter Google credentials.
- If the Google organization enforces MFA, complete the verification step.
- Upon successful authentication, Google redirects to Udyamo HRMS.
- Udyamo HRMS matches the Google email to an employee record and logs the user in.

Azure AD SSO
Azure AD SSO is designed for organizations that use Microsoft 365 (Office 365) and Azure Active Directory for identity management.
Admin Setup: Configuring Azure AD SSO
Configuring Azure AD SSO requires steps in both the Azure Portal and Udyamo HRMS.
Step 1: Register an Application in Azure AD
- Log in to the Azure Portal.
- Navigate to Azure Active Directory > App registrations.
- Click New registration.
- Fill in the registration form:
| Field | Value |
|---|---|
| Name | Udyamo HRMS |
| Supported account types | Accounts in this organizational directory only (Single tenant) |
| Redirect URI | Web — https://your-domain.udyamo.com/users/auth/azure_oauth2/callback |
- Click Register.
- On the application overview page, note the Application (client) ID and Directory (tenant) ID.
Step 2: Create a Client Secret
- In the registered application, navigate to Certificates & secrets.
- Click New client secret.
- Enter a description (e.g., "Udyamo HRMS SSO") and select an expiry period.
- Click Add.
- Copy the Secret Value immediately — it is shown only once.
Warning: The client secret is displayed only at the time of creation. If you lose it, you must create a new one.
Step 3: Configure API Permissions
- In the registered application, navigate to API permissions.
- Click Add a permission.
- Select Microsoft Graph.
- Choose Delegated permissions.
- Add the following permissions:
| Permission | Purpose |
|---|---|
openid | Required for OpenID Connect authentication |
email | Access the user's email address |
profile | Access the user's basic profile (name) |
- Click Add permissions.
- Click Grant admin consent for [Your Organization] to approve the permissions for all users.
Step 4: Configure Azure AD in Udyamo HRMS
- Log in to Udyamo HRMS as an administrator.
- Navigate to Settings > Security > Single Sign-On.
- In the Azure AD section, click Configure.
- Enter the following:
| Field | Description | Required |
|---|---|---|
| Tenant ID | The Directory (tenant) ID from Azure AD | Yes |
| Client ID | The Application (client) ID from Azure AD | Yes |
| Client Secret | The client secret value you created | Yes |
| Allowed Domain(s) | Restrict SSO to specific email domains | Recommended |
- Click Save.
- Toggle Enable Azure AD SSO to on.

Step 5: Test Azure AD SSO
- Open an incognito/private browser window.
- Navigate to the Udyamo HRMS login page.
- Click Sign in with Microsoft.
- Enter Microsoft 365 credentials for a user whose email matches an Udyamo HRMS employee record.
- Complete any MFA prompts from Azure AD.
- Verify that you are successfully logged in.
Employee Login Flow: Azure AD
- Navigate to the Udyamo HRMS login page.
- Click Sign in with Microsoft.
- If not already signed in to Microsoft 365, enter Microsoft credentials.
- Complete MFA if required by the Azure AD conditional access policy.
- Upon successful authentication, Azure AD redirects to Udyamo HRMS.
- Udyamo HRMS matches the Microsoft email to an employee record and logs the user in.
How SSO Works with Existing Accounts
When an employee first uses SSO to log in, Udyamo HRMS links their SSO identity to their existing account based on the email address match.
Account Linking
| Scenario | Result |
|---|---|
| Employee has a password-based account and the SSO email matches | SSO login succeeds. The account is linked to the SSO provider. The employee can still use password login. |
| Employee does not have an Udyamo HRMS account | SSO login is rejected. An admin must first create the employee record with the matching email. |
| Email in SSO provider does not match any Udyamo HRMS email | SSO login is rejected with an error message. |
| Employee uses both Google and Azure AD | Both can be linked to the same account if both emails match. |
Tip: When onboarding new employees, ensure their Udyamo HRMS email matches their Google Workspace or Azure AD email to enable SSO from day one.
SSO vs. Password Login
SSO does not disable password-based login unless the administrator explicitly configures it.
| Login Method | Availability | Notes |
|---|---|---|
| Email + Password | Always available (unless disabled) | Default method for all users |
| Google SSO | Available when configured and enabled | Requires Google Workspace account |
| Azure AD SSO | Available when configured and enabled | Requires Microsoft 365 account |
| OTP Login | Available when configured and enabled | Passwordless alternative |
Disabling Password Login
If your organization wants to enforce SSO-only login:
- Navigate to Settings > Security > Login Methods.
- Disable Email + Password Login.
- Ensure at least one SSO provider is configured and enabled.
Warning: Before disabling password login, verify that all employees can successfully log in via SSO. Keep at least one administrator account with password access as a fallback in case of SSO provider outages.
Managing SSO Providers
Viewing SSO Configuration
- Navigate to Settings > Security > Single Sign-On.
- The page shows the status of each SSO provider:
| Provider | Status | Details |
|---|---|---|
| Google OAuth2 | Enabled / Disabled | Client ID (masked), allowed domains |
| Azure AD | Enabled / Disabled | Tenant ID (masked), allowed domains |
Updating SSO Configuration
- Click Edit next to the provider you want to update.
- Modify the Client ID, Client Secret, Tenant ID, or allowed domains.
- Click Save.
- Test the updated configuration.
Disabling SSO
- Navigate to Settings > Security > Single Sign-On.
- Toggle the provider off.
- Employees will no longer see the SSO login button for that provider.
Warning: Disabling SSO does not delete the configuration — it only hides the login option. You can re-enable it at any time.
Troubleshooting SSO Issues
Common Problems and Solutions
| Problem | Possible Cause | Solution |
|---|---|---|
| "Account not found" after SSO login | Email in SSO provider does not match any Udyamo HRMS email | Verify the employee's email in both systems matches exactly |
| "Invalid redirect URI" error | The redirect URI in the SSO provider does not match the Udyamo HRMS callback URL | Correct the redirect URI in Google Cloud Console or Azure Portal |
| "Admin consent required" (Azure AD) | The Azure AD admin has not granted consent for the app permissions | Grant admin consent in Azure Portal > App Registrations > API Permissions |
| SSO button not visible on login page | SSO provider is not enabled in Udyamo HRMS settings | Enable the provider in Settings > Security > Single Sign-On |
| Login loops or redirects repeatedly | Cookie or session issue | Clear browser cookies, try incognito mode, or check third-party cookie settings |
| "Access denied" from Google | User's Google account is not in the allowed domain | Add the user's domain to the allowed domains list or check domain restrictions |
| Azure AD conditional access blocks login | Azure AD policy blocks the application | Review Azure AD conditional access policies to allow the Udyamo HRMS app |
Diagnostic Checklist
When troubleshooting SSO, verify the following:
- The SSO provider is enabled in Udyamo HRMS settings.
- The Client ID and Client Secret are correct and not expired.
- The redirect URI in the identity provider matches the Udyamo HRMS callback URL exactly (including https:// and the path).
- The employee's email address in the identity provider matches their Udyamo HRMS email.
- The identity provider has granted the required permissions (API permissions for Azure AD, OAuth scopes for Google).
- The browser allows third-party cookies or the SSO domain is whitelisted.

Security Considerations
| Consideration | Recommendation |
|---|---|
| Client secret rotation | Rotate Azure AD client secrets before expiry. Google OAuth2 secrets do not expire by default but should be rotated periodically. |
| Domain restriction | Always configure allowed domains to prevent unauthorized accounts from attempting SSO. |
| MFA at the IdP | Enable multi-factor authentication in Google Workspace or Azure AD for an additional security layer. |
| Conditional access (Azure AD) | Use Azure AD conditional access policies to restrict login by device, location, or risk level. |
| Account deprovisioning | When an employee leaves, removing them from the identity provider automatically prevents SSO access to Udyamo HRMS. |
| SSO + 2FA | SSO and TOTP 2FA can coexist. If an organization uses SSO with IdP-level MFA, additional 2FA in Udyamo HRMS may be redundant but can be enabled for extra security. |
Quick Reference
| Action | Navigation | Notes |
|---|---|---|
| Configure Google SSO | Settings > Security > SSO > Google OAuth2 | Requires Google Cloud Console setup |
| Configure Azure AD SSO | Settings > Security > SSO > Azure AD | Requires Azure Portal setup |
| Enable/disable SSO | Settings > Security > SSO > Toggle | Immediate effect on login page |
| Test SSO | Open incognito window > Login page > SSO button | Use a matching employee email |
| Disable password login | Settings > Security > Login Methods | Ensure SSO works for all users first |
What Comes Next
With SSO configured, the next chapter covers integrating Udyamo HRMS with Microsoft Teams for in-chat HR actions. Proceed to Chapter 46: MS Teams Integration.