Firebase microsoft oauth: specify tenant id or not?

Viewed 100

This morning I setup Microsoft oauth for my app for the first time. This is svelte code but I trust it will be readable by most people:

<script lang="ts">
    import { OAuthProvider } from "firebase/auth";
    import { getAuth,signInWithPopup } from "firebase/auth";
    import {firebaseApp} from "$lib/config";

    const provider = new OAuthProvider('microsoft.com');
    const auth = getAuth(firebaseApp)

    function clicked() {
        signInWithPopup(auth, provider).then(result => console.log({result})).catch(console.error)
    }
</script>

<button class="btn btn-primary" on:click={clicked}>Sign in with Microsoft</button>

When the signin popup comes up, and I enter my sign-in credentials that I use for Office 365 and Azure Portal, it says:

xxxxx.com isn't in our system. Make sure that you typed it correctly

When I specify my Azure AD tenant ID as follows:

    const provider = new OAuthProvider('microsoft.com');
    provider.setCustomParameters({
        tenant: 'xxxxxxxxx-b7f4-4fd7-a75c-55d8316005a1',
    });
    const auth = getAuth(firebaseApp)

I can log in fine. I am making a SaaS product, so I want anyone to be able to login.

So my questions are:

  • Does this mean only identities in my Azure AD can log in?
  • Why does specifying the tenant id of common not work?
0 Answers
Related