Set tenantId microsoft oauth in front end

Hi, I want to set tenantId in the frontend so users are guided to https://login.microsoftonline.com/tenant instead of https://login.microsoftonline.com/common. Microsoft auth is really a pain in the ass so this is a must have so when someone presses login they are already in the correct tenant login page. However I cant find a way to do this in the front end, either change the url we use for microsoft auth or set a tenantId. The reason I want this is because I have 1 multi tenant project, each tenant can set the tenant id they want their users to login with. I found a supabase option to do it for the backend. But this is not what I am looking for as this is for all logins, regardless of which tenant the user is in. https://supabase.com/docs/guides/auth/social-login/auth-azure#configure-a-tenant-url-optional
1 Reply
Idris
IdrisOP8h ago
https://firebase.google.com/docs/auth/web/microsoft-oauth#handle_the_sign-in_flow_with_the_firebase_sdk This is for example what i want
provider.setCustomParameters({
// Optional "tenant" parameter in case you are using an Azure AD tenant.
// eg. '8eaef023-2b34-4da1-9baa-8bc8c9d6a490' or 'contoso.onmicrosoft.com'
// or "common" for tenant-independent tokens.
// The default value is "common".
tenant: 'TENANT_ID'
});
provider.setCustomParameters({
// Optional "tenant" parameter in case you are using an Azure AD tenant.
// eg. '8eaef023-2b34-4da1-9baa-8bc8c9d6a490' or 'contoso.onmicrosoft.com'
// or "common" for tenant-independent tokens.
// The default value is "common".
tenant: 'TENANT_ID'
});

Did you find this page helpful?