Skip to content

Commit 446ff4c

Browse files
author
Bas de Vaan
committed
Keep endSessionEndpoint in OAuthChopperObject
1 parent 53a1c40 commit 446ff4c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/src/oauth_chopper.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class OAuthChopper {
2222
/// OAuth authorization endpoint.
2323
final Uri authorizationEndpoint;
2424

25+
/// OAuth endpoint to end session.
26+
final Uri? endSessionEndpoint;
27+
2528
/// OAuth identifier
2629
final String identifier;
2730

@@ -37,6 +40,7 @@ class OAuthChopper {
3740
required this.authorizationEndpoint,
3841
required this.identifier,
3942
required this.secret,
43+
this.endSessionEndpoint,
4044

4145
/// OAuth storage for storing credentials.
4246
/// By default it will use a in memory storage [MemoryStorage]. For persisting the credentials implement a custom [OAuthStorage].
@@ -47,9 +51,7 @@ class OAuthChopper {
4751
/// Get stored [OAuthToken].
4852
Future<OAuthToken?> get token async {
4953
final credentialsJson = await _storage.fetchCredentials();
50-
return credentialsJson != null
51-
? OAuthToken.fromJson(credentialsJson)
52-
: null;
54+
return credentialsJson != null ? OAuthToken.fromJson(credentialsJson) : null;
5355
}
5456

5557
/// Provides an [OAuthAuthenticator] instance.
@@ -70,8 +72,7 @@ class OAuthChopper {
7072
if (credentialsJson == null) return null;
7173
final credentials = Credentials.fromJson(credentialsJson);
7274
try {
73-
final newCredentials =
74-
await credentials.refresh(identifier: identifier, secret: secret);
75+
final newCredentials = await credentials.refresh(identifier: identifier, secret: secret);
7576
await _storage.saveCredentials(newCredentials.toJson());
7677
return OAuthToken.fromCredentials(newCredentials);
7778
} catch (e) {
@@ -87,8 +88,7 @@ class OAuthChopper {
8788
///
8889
/// Throws an exception if the grant fails.
8990
Future<OAuthToken> requestGrant(OAuthGrant grant) async {
90-
final credentials =
91-
await grant.handle(authorizationEndpoint, identifier, secret);
91+
final credentials = await grant.handle(authorizationEndpoint, identifier, secret);
9292

9393
await _storage.saveCredentials(credentials);
9494

0 commit comments

Comments
 (0)