Skip to content

Decisions7 min read

Single sign-on for custom business software: letting staff log in with Microsoft or Google accounts

By Published

Short answerFor your own staff on Microsoft 365, register a single-tenant app and sign in with OpenID Connect. On Google Workspace, use OpenID Connect and check the hd claim, or a custom SAML app. Key every account on the provider's fixed ID, never the email. Keep the app's own sessions short and switch the account off in the app as well, because disabling someone in the directory does not end a session your app already issued.

What changes when the directory owns the login

With single sign-on, your ERP or HR system stops keeping passwords. A staff member clicks "Sign in with Microsoft" or "Sign in with Google", proves who they are to that provider, and comes back with a signed token that says who they are. Microsoft describes OpenID Connect as a way to enable single sign-on between apps by using a security token called an ID token.

The part buyers miss is what the app does next. It reads the token, finds the matching user record and starts its own session. From that moment, the app decides what the person can see, and the app decides when the session ends.

So the record has to be keyed on the right thing. Microsoft's ID token reference says the email claim isn't guaranteed to be correct, can change, and should never be used for authorization or to save data for a user. Its own example is the one that worries me: a new employee can be given the email address of someone who has left. Store the oid and tid claims for Microsoft accounts and the sub claim for Google accounts, which Google describes as unique among all Google Accounts and never reused.

I would not start an SSO build until the existing user table has a column for that ID. Matching on email at first login is fine for linking an account once. After that, the email is a label.

OIDC or SAML, single-tenant or multitenant: the decision table

Two choices settle most of the design. The protocol: OpenID Connect (OIDC) or SAML. The audience: only your organisation, or many organisations. Microsoft lets you register an app as single-tenant, open only to accounts in your own directory, or multitenant, open to work and school accounts from any Microsoft Entra directory.

One rule from Microsoft cuts the options down: SAML single sign-on can only be configured on single-tenant apps or gallery apps. A multitenant app shows the SAML settings greyed out.

Your situationWhat I would buildWhy
Your own staff, all on Microsoft 365OIDC, single-tenant app registrationOnly your directory can sign in, and app roles arrive in the token
Your own staff, all on Google WorkspaceOIDC, rejecting any ID token whose hd claim is not your domainGoogle says the hd value in the request is only a UI hint and the token's hd claim is what you must check
Staff split across Microsoft and GoogleOIDC with both providers, each linked to one internal user recordOne person, one record, two possible ID keys
A product you sell to many companies on MicrosoftOIDC, multitenant registration, with an allow-list of tenant IDsSAML is not available on a multitenant app, and the tid claim tells you which company signed in
A customer's IT team insists on SAMLSAML, set up per customer as their own enterprise app or custom SAML appSAML is configured on the customer's side, one connection each

What happens on someone's last day

This is where SSO earns its place, and where it is most often oversold. Microsoft's guidance on revoking access is plain about it. An admin can disable the account and revoke its sessions, and after that the user cannot get new tokens. But an app that issued its own session cookie controls access through its own rules, and Microsoft Entra ID cannot revoke a session token the app issued. Access tokens issued by Entra ID last one hour by default.

So the speed of offboarding depends on choices made inside your software, not in the directory. A made-up example shows the gap. A storekeeper leaves at 17:00 and IT disables the account at 17:05.

  • Microsoft recommends automated provisioning and deprovisioning, and says its app provisioning typically runs every 20 to 40 minutes.
  • Microsoft's single sign-out uses a front-channel logout URL that each app registers. Your app has to clear the session and return a 200 response when that request arrives.
  • On the Google side, Google says changes to a custom SAML app can take up to 24 hours, though they typically happen sooner. I would not rely on a settings change as the offboarding step.
  • Whatever the protocol, the app needs its own Deactivate user button, and the HR leaver process should press it.
How the app was builtWhen the storekeeper loses access
App session lasts 30 days and never returns to MicrosoftUp to 30 days later, unless someone deactivates the user inside the app
App session lasts 8 hours, then sends the user back to sign inAt the latest, the end of that 8 hours
App session checks the directory again every hourWithin the hour
The user is also deactivated in the app, by a person or by automated provisioningAs soon as the app processes the change

Roles from the directory or roles kept in the app

Microsoft lets you define app roles on your app registration, assign them to users or groups, and receive them in a roles claim when the user signs in. Groups are the other option, delivered in a groups claim. Microsoft points out the trade-off: groups belong to a tenant, so an app that authorizes by group ID breaks in the next tenant, while app roles move with the application.

There are limits to know before you design around groups. A token carries at most 200 group IDs as a JWT or 150 in SAML; past that, the app has to query Microsoft Graph for the list. Assigning a group to an enterprise app requires Microsoft Entra ID P1 or P2, and the assignment does not cascade to nested groups. Google's custom SAML app lets you send up to 75 groups, including groups the user belongs to indirectly.

My rule: the directory answers two questions, whether this person may enter the system at all and which broad role they hold, such as Finance or Warehouse. The app answers the rest: which branch's records, which approval limits, which screens. Microsoft's own advice is close to this, keeping app roles to stable categories and fine-grained permissions in the application's own data. How to design those in-app permissions is in my post on roles, permissions and audit trails.

One practical point. If the role comes from the token, read it at every sign-in and overwrite the role stored in the app. Otherwise a person moved out of Finance in the directory keeps Finance rights in the ERP.

The SSO questions to settle in your scope

Before I quote this work, I would want written answers to these. Most are for your IT admin, not for me.

  • Which directory holds your staff: Microsoft Entra ID, Google Workspace or both?
  • Will anyone outside the company sign in: auditors, contractors, franchise staff? Guests in a Microsoft directory can sign in to a single-tenant app.
  • Who in your company can register an app or create a custom SAML app? Microsoft's steps name the Cloud Application Administrator role; Google's name a super administrator.
  • Do you hold Microsoft Entra ID P1 or P2, if you want to assign whole groups to the app?
  • Which roles should come from the directory, and which stay in the app?
  • How long may an app session last before the user signs in again?
  • Who deactivates a leaver inside the app, and on which day?
  • Is there a fallback login for a directory outage, and who holds it?

Where SSO sits in what I build

In an ERP, HR or CRM I build, SSO is part of the custom software scope, so it is a fixed quote agreed in writing before work starts. The answers to the list above decide the size: one provider with roles kept in the app is a small piece of work; two providers, roles from the directory, automated deprovisioning and per-customer SAML for a multitenant product is several.

My mobile app packages include sign-up and login for your users from Launch at $999 upward, and Growth at $1,699 adds a Node.js backend with PostgreSQL. Staff sign-in through your company directory, with directory roles and leaver handling, is the kind of integration I would scope and price separately rather than squeeze into a package.

Questions

Do we need a paid Microsoft Entra licence for staff to sign in?
Microsoft's assignment page says group-based assignment to an app requires Microsoft Entra ID P1 or P2. Assigning individual users and plain sign-in are described without that requirement. Check your own plan on Microsoft's pricing page before the scope is fixed, because it changes how roles are assigned.
Can staff still use their personal Gmail accounts?
Not if the app checks the hd claim, and I would make it check. Google says to verify that the ID token's hd claim matches an accepted domain. A personal account will not carry your company's Workspace domain, so it is refused.
Should the app keep a password login as well?
I would keep one or two break-glass admin accounts with strong passwords and two-factor login, used only if the directory is unreachable. Everyone else signs in through the directory, so there is no second password to forget when they leave.

Sources

Platform rules and fees in this article were checked against these official pages on 16 November 2026. They change, so confirm before you rely on them.

Sannan Malik is a software architect and product builder with 8+ years in software, CEO of Alpha Notic FZE and a Certified Scrum Product Owner. He builds mobile apps and business software for companies in the UAE, the wider Gulf, the UK, the US, Canada and Australia.

Let's build it

Got an idea? Let's talk.

The fastest way to reach me is WhatsApp. Tell me what you're building and I'll reply with how I'd approach it, which package fits, or what a custom scope would look like.

Message me on WhatsApp