signInWithProvider method
Sign in with a provider using Flutter
This method will open a browser window to sign in with the provider.
provider
is the OAuth2 provider to sign in.
If you want to open it manually, you can get the link using signInWithProvider.
completer
is the completer to complete when the URL launching is done.
Implementation
@override
String signInWithProvider(String provider, [Completer<bool>? completer]) {
var link = super.signInWithProvider(provider);
launchUrl(Uri.parse(link),
webOnlyWindowName: '_self',
mode: LaunchMode.externalApplication,
webViewConfiguration: const WebViewConfiguration(
headers: {'OverrideUserAgent': 'Mozilla/5.0 Google'}))
.then((value) {
completer?.complete(value);
}).onError((error, stackTrace) {
completer?.completeError(error ?? Exception(), stackTrace);
});
return link;
}