[📚] Get ms graph access token from flutterfire signInWithAuthProvider method
I am trying to use microsoft authentication in my app, now with the new support. I used his: https://firebase.google.com/docs/auth/flutter/federated-auth#microsoft, but my app needs to have the access token to get some info using Microsofts graph api. To be clear I am talking about the access token aqauired from credential.accessToken in for example web (https://firebase.google.com/docs/auth/web/microsoft-oauth#advanced:-handle-the-sign-in-flow-manually). If this still isn't clear, I will gladly answer your questions.
Hi! Hope everybody's having a nice day.
I'm having the same issue. With the response from "FirebaseAuth.instance.signInWithProvider(microsoftProvider)" there is no way of knowing the origin of that user. In other words, from which company that is a client of my app that user is trying to log in from.
Basically what I needed to find was the Azure AD tenant ID from that user. I can only get that making a call to "https://graph.microsoft.com/v1.0/organization/". But to do so, I would need the credential.accessToken. which is not available for the mobile platform.
Edit: Found out that the tenantID info is inside the JWT of the AccessToken, so I wouldn't need to make the request to obtain that information, but I'd still need the AccessToken.
This was added with #9593