You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// If you are trying to store cookies from a "set-cookie" header response, consider using the [saveFromSetCookieHeader] utility method which parses the header string.
/// Uses the [_allCookies] map to update values in shared preferences.
112
112
///
113
113
/// Strips expired cookies before storing in shared preferences
114
114
Future<void> _updatePersistentStorage() async {
115
-
logDebugMessage('Updating persistent storage with cookies...')
115
+
logDebugMessage('Updating persistent storage with cookies');
116
116
Map<String, List<String>> mapToStore = {};
117
117
_allCookies?.forEach((key, value) {
118
118
String uriString = key.toString();
@@ -131,12 +131,12 @@ class SuperTokensCookieStore {
131
131
///
132
132
/// If you are trying to add cookies to a "cookie" header for a network call, consider using the [getCookieHeaderStringForRequest] which creates a semi-colon separated cookie string for a given Uri.
/// An [http.BaseClient] implementation for using SuperTokens for your network requests.
16
17
/// To make use of supertokens, use this as the client for making network calls instead of [http.Client] or your own custom clients.
17
-
/// If you use a custom client for your network calls pass an instance of it as a paramter when initialising [Client], pass [http.Client()] to use the default.
18
+
/// If you use a custom client for your network calls pass an instance of it as a parameter when initialising [Client], pass [http.Client()] to use the default.
18
19
ReadWriteMutex _refreshAPILock =ReadWriteMutex();
19
20
20
21
classCustomRequest {
@@ -48,6 +49,7 @@ class Client extends http.BaseClient {
48
49
49
50
Future<http.StreamedResponse> _sendWithRetry(
50
51
CustomRequest customRequest) async {
52
+
logDebugMessage('Sending request');
51
53
if (Client.cookieStore ==null) {
52
54
Client.cookieStore =SuperTokensCookieStore();
53
55
}
@@ -59,18 +61,21 @@ class Client extends http.BaseClient {
59
61
60
62
if (SuperTokensUtils.getApiDomain(customRequest.request.url.toString()) !=
61
63
SuperTokens.config.apiDomain) {
64
+
logDebugMessage('Not matching api domain, using inner client');
62
65
return _innerClient.send(customRequest.request);
63
66
}
64
67
65
68
if (SuperTokensUtils.getApiDomain(customRequest.request.url.toString()) ==
66
69
SuperTokens.refreshTokenUrl) {
70
+
logDebugMessage('Refresh token URL matched');
67
71
return _innerClient.send(customRequest.request);
68
72
}
69
73
70
74
if (!Utils.shouldDoInterceptions(
71
75
customRequest.request.url.toString(),
72
76
SuperTokens.config.apiDomain,
73
77
SuperTokens.config.sessionTokenBackendDomain)) {
78
+
logDebugMessage('Skipping interceptions');
74
79
return _innerClient.send(customRequest.request);
75
80
}
76
81
@@ -145,10 +150,12 @@ class Client extends http.BaseClient {
logDebugMessage('Max attempts of ${SuperTokens.config.maxRetryAttemptsForSessionRefresh} reached for refreshing, cannot continue');
148
154
throwSuperTokensException(
149
155
"Received a 401 response from ${customRequest.request.url}. Attempted to refresh the session and retry the request with the updated session tokens ${SuperTokens.config.maxRetryAttemptsForSessionRefresh} times, but each attempt resulted in a 401 error. The maximum session refresh limit has been reached. Please investigate your API. To increase the session refresh attempts, update maxRetryAttemptsForSessionRefresh in the config.");
0 commit comments