@@ -22,6 +22,9 @@ class OAuthChopper {
22
22
/// OAuth authorization endpoint.
23
23
final Uri authorizationEndpoint;
24
24
25
+ /// OAuth endpoint to end session.
26
+ final Uri ? endSessionEndpoint;
27
+
25
28
/// OAuth identifier
26
29
final String identifier;
27
30
@@ -37,6 +40,7 @@ class OAuthChopper {
37
40
required this .authorizationEndpoint,
38
41
required this .identifier,
39
42
required this .secret,
43
+ this .endSessionEndpoint,
40
44
41
45
/// OAuth storage for storing credentials.
42
46
/// By default it will use a in memory storage [MemoryStorage] . For persisting the credentials implement a custom [OAuthStorage] .
@@ -47,9 +51,7 @@ class OAuthChopper {
47
51
/// Get stored [OAuthToken] .
48
52
Future <OAuthToken ?> get token async {
49
53
final credentialsJson = await _storage.fetchCredentials ();
50
- return credentialsJson != null
51
- ? OAuthToken .fromJson (credentialsJson)
52
- : null ;
54
+ return credentialsJson != null ? OAuthToken .fromJson (credentialsJson) : null ;
53
55
}
54
56
55
57
/// Provides an [OAuthAuthenticator] instance.
@@ -70,8 +72,7 @@ class OAuthChopper {
70
72
if (credentialsJson == null ) return null ;
71
73
final credentials = Credentials .fromJson (credentialsJson);
72
74
try {
73
- final newCredentials =
74
- await credentials.refresh (identifier: identifier, secret: secret);
75
+ final newCredentials = await credentials.refresh (identifier: identifier, secret: secret);
75
76
await _storage.saveCredentials (newCredentials.toJson ());
76
77
return OAuthToken .fromCredentials (newCredentials);
77
78
} catch (e) {
@@ -87,8 +88,7 @@ class OAuthChopper {
87
88
///
88
89
/// Throws an exception if the grant fails.
89
90
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);
92
92
93
93
await _storage.saveCredentials (credentials);
94
94
0 commit comments