For a Flutter mobile app I am trying to use a Microsoft OAuthProvider to get a Firebase credential with which to sign the user into Firebase with their Azure AD account.
The closest I got was using a third party Active Directory auth package to log the user in and get an access token. However the sign-in to Firebase fails with an error message that suggests the idToken is invalid.
final AadOAuth oauth = new AadOAuth(config); await oauth.login(); // accessToken looks legit String accessToken = await oauth.getAccessToken(); String idToken = await oauth.getIdToken(); OAuthProvider provider = OAuthProvider('microsoft.com'); // Also tried the constructor without the idToken OAuthCredential credential = provider.credential(accessToken: accessToken, idToken: idToken); // app fails here: await FirebaseAuth.instance.signInWithCredential(credential); // this works fine, but only on web platform: await FirebaseAuth.instance.signInWithPopup(provider);
Because it is a platform specific error (iOS in this case), the exception details are not surfaced. All I get is:
PlatformException(internal-error, ) nativeErrorCode: 17999
Here is my app settings in the Azure portal:
Full manifest here
Has anyone been successful in using Microsoft Auth to sign a user in to Firebase in a Flutter mobile app?