getCode method

  1. @override
Future<AuthCode?> getCode(
  1. AuthServer server,
  2. String code
)
override

Must return AuthCode for its identifiying code.

This must return an instance of AuthCode where AuthCode.code matches code. Return null if no matching code.

Implementation

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

  final storage = await query.fetchOne();
  return storage?.asAuthCode();
}