complete method
Future<Credentials?>
complete(
- Uri responseUrl
)
Implementation
Future<oauth2.Credentials?> complete(Uri responseUrl) async {
try {
if (!kIsWeb && Platform.isIOS) {
await closeInAppWebView();
}
} catch (_) {
// if this doesn't work, we still want everything else to happen
}
final code = responseUrl.queryParameters['code'] ?? '';
if (code.isEmpty) {
return null;
}
final codeParameters = responseUrl.queryParameters;
final codeVerifier = await popCodeVerifier();
if (codeVerifier == null) {
return null;
}
final grant = _getAuthGrant(codeVerifier);
grant.getAuthorizationUrl(callbackUrl, scopes: scopes);
final client = await grant.handleAuthorizationResponse(codeParameters);
final credentials = client.credentials;
return credentials;
}