Ad

Firebase Microsoft Login Cannot Get Access Token In Swift IOS

I'm using Microsoft Login to Authenticate Users in Firebase.

Everythings works fine so far. Now I want to access the Microsoft API with the access token.

However, I'm not able to get the access token.

 provider = OAuthProvider(providerID: "microsoft.com")

 provider?.customParameters = [
     "prompt": "consent",
 ]

 provider?.getCredentialWith(nil) { (credentials, error) in
     //credentials doesn't contain access token
 }

The reason for that is because the returned credentials are of type AuthCredentials and not OAuthCredentials like for the Google or Facebook Login.

Is there any other solution to get the access token from the login?

Ad

Answer

Refer to below gitHub:

https://github.com/firebase/firebase-ios-sdk/issues/3076

There is a bug on firebase iOS sdk, the issue is oauth credential property is not exposed to public.

Temporarily you can make below pull request changes, it will work until firebase team releases new update framework.

https://github.com/firebase/firebase-ios-sdk/pull/2916/files

Ad
source: stackoverflow.com
Ad