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
serverTokenRefreshEndpoint:'/api/token-refresh/', // Server endpoint to send refresh request
186
186
refreshTokenPropertyName:'refresh_token', // Key in server response that contains the refresh token
187
187
tokenExpireName:'exp', // Field containing token expiration
188
-
refreshLeeway:0// Amount of time to send refresh request before token expiration
188
+
refreshLeeway:0, // Amount of time in seconds to send refresh request before token expiration
189
+
tokenRefreshInvalidateSessionResponseCodes: [401, 403], // Array of response codes that cause an immediate session invalidation if received when attempting to refresh the token
190
+
refreshAccessTokenRetryAttempts:0, // Number of token retry attempts to make
191
+
refreshAccessTokenRetryTimeout:1000, // Amount of time in milliseconds to wait between token refresh retry attempts
192
+
tokenRefreshFailInvalidateSession:false// Enables session invalidation if all token refresh retry requests fail
returnreject(newError('unable to refresh token'));
108
112
}
109
113
}else{
110
114
// The refresh token might not be expired, we can't test this on the client so attempt to refresh the token. If the server rejects the token the user session will be invalidated
An automatic token refresh will be scheduled with the new expiration date from the returned refresh token. That expiration will be merged with the response and the promise resolved.
126
130
127
131
@method authenticate
128
-
@param {Object} credentials The credentials to authenticate the session with
129
-
@param {Object} headers Optional headers to send with the authentication request
130
-
@return {Promise} A promise that resolves when an auth token is successfully acquired from the server and rejects otherwise
132
+
@param {Object} credentials Credentials to authenticate the session with
133
+
@param {Object} headers Headers to send with the authentication request
134
+
@return {Promise} Promise that resolves when an auth token is successfully acquired from the server and rejects otherwise
If both `token` and `expiresAt` are non-empty, and `expiresAt` minus the optional refres leeway is greater than the calculated `now`, the token refresh will be scheduled through later.
142
146
143
147
@method scheduleAccessTokenRefresh
148
+
@param {Integer} expiresAt Timestamp when the token expires
Handles token refresh fail status. If the server response to a token refresh has a status of 401 or 403 then the token in the session will be invalidated and the sessionInvalidated provided by ember-simple-auth will be triggered.
290
301
291
302
@method handleTokenRefreshFail
303
+
@param {Integer} refreshStatusCode Status code received when attempting to refresh token
304
+
@param {String} refreshToken Refresh token
305
+
@param {Integer} attempts Number of attempts that have been made so far
0 commit comments