signInOAuth method
Starts a OAuth sign-in flow for provider
using Firebase.
The instance of FirebaseAuth will be from the default Firebase App
Unless withApp is used to build an instance
It will return authentication result OAuthCredential
.
If supported by Firebase, this will contains the provider access
token as accessToken
.
Implementation
@override
Future<OAuthCredential> signInOAuth(String provider, List<String> scopes,
[Map<String, String>? customOAuthParameters]) async {
final oAuthProvider = web.OAuthProvider(provider);
scopes.forEach((scope) => oAuthProvider.addScope(scope));
if (customOAuthParameters != null) {
oAuthProvider.setCustomParameters(customOAuthParameters);
}
final result =
await web.app(_app().name).auth().signInWithPopup(oAuthProvider);
return OAuthCredential(
signInMethod: "oauth",
providerId: result.credential.providerId,
accessToken: result.credential.accessToken,
idToken: result.credential.idToken,
secret: result.credential.secret,
);
}