authenticateCallback method

Future authenticateCallback(
  1. RequestContext req,
  2. ResponseContext res, [
  3. AngelAuthOptions? options
])

The endpoint that is invoked by the third-party after successful authentication.

Implementation

Future<dynamic> authenticateCallback(RequestContext req, ResponseContext res,
    [AngelAuthOptions? options]) async {
  var grant = _createGrant();
  grant.getAuthorizationUrl(this.options.redirectUri,
      scopes: this.options.scopes);

  try {
    var client =
        await grant.handleAuthorizationResponse(req.uri!.queryParameters);
    return await verifier(client, req, res);
  } on oauth2.AuthorizationException catch (e) {
    return await onError(e, req, res);
  }
}