AuthOAuthProviderFixture constructor

AuthOAuthProviderFixture({
  1. String providerId = 'fixture-oauth',
  2. Map<String, dynamic> profile = const <String, dynamic>{'sub' : 'fixture-account', 'email' : 'fixture@example.test', 'name' : 'Fixture User'},
  3. AuthProviderType type = AuthProviderType.oauth,
})

Creates a provider fixture hosted below https://provider.example.test.

Implementation

AuthOAuthProviderFixture({
  this.providerId = 'fixture-oauth',
  this.profile = const <String, dynamic>{
    'sub': 'fixture-account',
    'email': 'fixture@example.test',
    'name': 'Fixture User',
  },
  this.type = AuthProviderType.oauth,
}) {
  provider = OAuthProvider<Map<String, dynamic>>(
    id: providerId,
    name: 'Fixture OAuth',
    clientId: 'fixture-client-id',
    clientSecret: 'fixture-client-secret-not-a-secret',
    authorizationEndpoint: origin.resolve('/authorize'),
    tokenEndpoint: origin.resolve('/token'),
    userInfoEndpoint: origin.resolve('/userinfo'),
    redirectUri: 'https://app.example.test/auth/callback/$providerId',
    type: type,
    scopes: const <String>['openid', 'profile', 'email'],
    profile: (claims) => AuthUser(
      id: claims['sub']?.toString() ?? '',
      email: claims['email']?.toString(),
      name: claims['name']?.toString(),
    ),
  );
}