Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
305 changes: 174 additions & 131 deletions packages/gotrue/lib/src/gotrue_client.dart

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions packages/gotrue/lib/src/types/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ typedef BroadcastChannel = ({
void Function() close,
});

enum AuthFlowType {
implicit,
pkce,
}
enum AuthFlowType { implicit, pkce }

/// An OAuth provider identifier.
///
Expand Down Expand Up @@ -147,8 +144,9 @@ enum OAuthClientRegistrationType {
const OAuthClientRegistrationType(this.value);

static OAuthClientRegistrationType fromString(String value) {
return OAuthClientRegistrationType.values
.firstWhere((e) => e.value == value);
return OAuthClientRegistrationType.values.firstWhere(
(e) => e.value == value,
);
}
}

Expand Down Expand Up @@ -218,16 +216,23 @@ class OAuthClient {
clientType: OAuthClientType.fromString(json['client_type'] as String),
tokenEndpointAuthMethod: json['token_endpoint_auth_method'] as String,
registrationType: OAuthClientRegistrationType.fromString(
json['registration_type'] as String),
json['registration_type'] as String,
),
clientUri: json['client_uri'] as String?,
redirectUris: (json['redirect_uris'] as List).cast<String>(),
grantTypes: (json['grant_types'] as List)
.map((e) => OAuthClientGrantType.values
.firstWhere((gt) => gt.value == e as String))
.map(
(e) => OAuthClientGrantType.values.firstWhere(
(gt) => gt.value == e as String,
),
)
.toList(),
responseTypes: (json['response_types'] as List)
.map((e) => OAuthClientResponseType.values
.firstWhere((rt) => rt.value == e as String))
.map(
(e) => OAuthClientResponseType.values.firstWhere(
(rt) => rt.value == e as String,
),
)
.toList(),
scope: json['scope'] as String?,
createdAt: json['created_at'] as String,
Expand Down
Loading
Loading