From ccb66494e93205f262214b64bb6801fcde06cadc Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Mon, 8 May 2017 23:43:33 -0400 Subject: [PATCH] Handle expired refresh tokens by reloading the page If a user's refresh token expires when their access token is also expired, they cannot obtain a new access token without authenticating with the openid provider. Currently StoryBoard doesn't handle this situation, and the session ends up in a state whereby the access token is invalid and most requests cause errors due to this. This commit hackily fixes this by reloading the page if the request for a new access token fails, such as when the refresh token is expired. Change-Id: Ied597133a76e5e61677fafd7bfb35d4107e0836c --- src/app/auth/http/http_oauth_token_interceptor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/auth/http/http_oauth_token_interceptor.js b/src/app/auth/http/http_oauth_token_interceptor.js index 3621b094..59663987 100644 --- a/src/app/auth/http/http_oauth_token_interceptor.js +++ b/src/app/auth/http/http_oauth_token_interceptor.js @@ -19,7 +19,7 @@ * and reissued when needed. */ angular.module('sb.auth').factory('httpOAuthTokenInterceptor', - function (AccessToken, $injector, $q, $log) { + function (AccessToken, $injector, $q, $log, $window) { 'use strict'; @@ -90,6 +90,7 @@ angular.module('sb.auth').factory('httpOAuthTokenInterceptor', }, function () { AccessToken.clear(); + $window.location.reload(); } ).finally(function () { // Inject the token, whether or not it exists, back into the