Setting up Microsoft Entra ID
Microsoft Entra ID (formerly Azure AD) is one of the OAuth providers supported by Klai Studio. Use it when users should sign in with their Microsoft work or school (Office 365) account.
Before using this guide, make sure you have already set up the shared Klai Studio OAuth requirements in the canonical reference:
That page covers the Klai Studio-side flow, required callback page, authLoginOauth, Users.oauthId, and onBeforeRegistration.
What Is Microsoft-Specific
For Microsoft Entra, the main provider-specific pieces are:
Create an Entra app registration of type
WebAdd the Klai Studio callback URL to the registration
Copy the Entra credentials into Klai Studio
Put the Directory (tenant) ID (or
common) in the Klai Studio Subdomain field β the same vault shape used by Auth0, Okta, and GoogleOptionally add the
emailclaim on ID tokens so Klai Studio can match users reliably
Create the Entra App Registration
In the Azure Portal, open Microsoft Entra ID β App registrations β New registration:
Name: for example
Klai Studioor your app nameSupported account types: usually Accounts in this organizational directory only (single tenant) for Office 365 orgs
Redirect URI platform: Web
Redirect URI (Callback URL)
In the app registration, under Authentication, add:
If the same Klai Studio app is reachable on multiple domains, add each callback URL as a separate redirect URI.
Examples:
https://bfmeetingsdev.clientportal.cloud/oauth/microsoft/callbackhttps://yourapp.fmbetterforms.com/oauth/microsoft/callback
Credentials to Copy Into Klai Studio
Klai Studio expects the same three OAuth vault fields used by other providers:
In Klai Studio, open the app environment menu, choose App Settings (or Env Edit β 3rd Party Auth), enable OAuth, and select provider Microsoft:
Client ID β Application (client) ID from the Entra overview page
Client Secret β value from Certificates & secrets β New client secret
Subdomain β Directory (tenant) ID, or a verified domain such as
contoso.onmicrosoft.com
Provider
Microsoft
Subdomain
Directory (tenant) ID, verified domain, or common
Client ID
Application (client) ID
Client Secret
Client secret value (not the secret ID)
Use common in Subdomain only when the Entra app is configured for multi-tenant / any Microsoft account. For a typical single-tenant Office 365 org, use the Directory (tenant) ID.
Token and API Permissions
In the Entra app registration:
API permissions β add Microsoft Graph delegated permissions
openid,profile, andemail(and grant admin consent if your tenant requires it).Token configuration β optional claims β ID β add email so the ID token includes an email address when available.
Klai Studio looks up users by email. If email is missing from the ID token, Klai Studio falls back to preferred_username when that value looks like an email.
Start Microsoft Login
Start the flow with a path action:
Allowing New Users
If OAuth users should be allowed to create Klai Studio users automatically, your FileMaker integration must support the onBeforeRegistration hook and return model.createUser = true when registration should proceed.
If that hook is missing, or if it does not allow the user, Klai Studio will not create the new account.
Optional: Force a Full Microsoft Logout
authLogout clears the Klai Studio session. If you also need to clear the Microsoft-hosted session, redirect the browser to Entra's end-session endpoint after authLogout.
Replace YOUR_TENANT_ID with your Directory (tenant) ID (or common if that matches how you configured the app).
Troubleshooting
Redirect URI mismatch β the URI in Entra must match exactly, including
httpsand/oauth/microsoft/callback.User not found / no email β add the ID token
emailoptional claim, or confirmpreferred_usernameis an email UPN.Wrong tenant β single-tenant apps need the Directory (tenant) ID in Klai Studio Subdomain, not another org's ID.
Personal Microsoft accounts fail β check the app registration's supported account types; work/school-only apps reject personal MSA accounts.
Last updated
Was this helpful?