File tree Expand file tree Collapse file tree 1 file changed +1
-21
lines changed Expand file tree Collapse file tree 1 file changed +1
-21
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,6 @@ class LogtoClient {
23
23
24
24
static late TokenStorage _tokenStorage;
25
25
26
- /// Logto automatically enables refresh token's rotation
27
- ///
28
- /// Simultaneous access token request may be problematic
29
- /// Use a request cache map to avoid the race condition
30
- static final Map <String , Future <AccessToken ?>> _accessTokenRequestCache = {};
31
-
32
26
/// Custom [http.Client] .
33
27
///
34
28
/// Note that you will have to call `close()` yourself when passing a [http.Client] instance.
@@ -81,21 +75,7 @@ class LogtoClient {
81
75
return accessToken;
82
76
}
83
77
84
- // If no valid access token is found in storage, use refresh token to claim a new one
85
- final cacheKey = TokenStorage .buildAccessTokenKey (resource);
86
-
87
- // Reuse the cached request if is exist
88
- if (_accessTokenRequestCache[cacheKey] != null ) {
89
- return _accessTokenRequestCache[cacheKey];
90
- }
91
-
92
- // Create new token request and add it to cache
93
- final newTokenRequest = _getAccessTokenByRefreshToken (resource);
94
- _accessTokenRequestCache[cacheKey] = newTokenRequest;
95
-
96
- final token = await newTokenRequest;
97
- // Clear the cache after response
98
- _accessTokenRequestCache.remove (cacheKey);
78
+ final token = await _getAccessTokenByRefreshToken (resource);
99
79
100
80
return token;
101
81
}
You can’t perform that action at this time.
0 commit comments