removeToken method

  1. @override
Future removeToken(
  1. AuthServer server,
  2. AuthCode grantedByCode
)
override

Must delete a AuthToken granted by grantedByCode.

If an AuthToken has been granted by exchanging AuthCode, that token must be revoked and can no longer be used to authorize access to a resource. grantedByCode should also be removed.

This method is invoked when attempting to exchange an authorization code that has already granted a token.

Implementation

@override
Future removeToken(AuthServer server, AuthCode grantedByCode) {
  final query = Query<ManagedAuthToken>(context)
    ..where((o) => o.code).equalTo(grantedByCode.code);

  return query.delete();
}