authenticate method
Open the Authentication Webpage
Returns Credential
from the authentication call
Implementation
Future<Credential?> authenticate() async {
final client = await _client;
Future<void> urlLauncher(String url) async {
if (await canLaunch(url)) {
await launch(url, forceWebView: true);
}
}
final authenticator = testAuthenticator ??
Authenticator(
client,
scopes: [],
urlLauncher: urlLauncher,
);
final credential = await authenticator.authorize();
_token = await credential?.getTokenResponse();
try {
await closeWebView();
} on MissingPluginException {
debugPrint('closeWebView is not avaialbe on this platform');
} on UnimplementedError {
debugPrint('closeWebView is not avaialbe on this platform');
}
return credential;
}