diff --git a/dashboard/src/authcallback.html b/dashboard/src/authcallback.html
index 9cb0617a6..43fbf378e 100644
--- a/dashboard/src/authcallback.html
+++ b/dashboard/src/authcallback.html
@@ -6,6 +6,11 @@ tmp.forEach(function (pair) {
if (pair.indexOf('access_token=') === 0) localStorage.token = pair.split('=')[1];
});
-window.location.href = '/';
+var redirectTo = '/';
+if (localStorage.getItem('redirectToHash')) {
+ redirectTo += localStorage.getItem('redirectToHash');
+ localStorage.removeItem('redirectToHash');
+}
+window.location.href = redirectTo;
diff --git a/dashboard/src/js/client.js b/dashboard/src/js/client.js
index 6e3e4423d..3e3b56519 100644
--- a/dashboard/src/js/client.js
+++ b/dashboard/src/js/client.js
@@ -2742,6 +2742,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
Client.prototype.login = function () {
this.setToken(null);
+ localStorage.setItem('redirectToHash', window.location.hash);
+
// start oidc flow
window.location.href = this.apiOrigin + '/openid/auth?client_id=' + ('<%= apiOrigin %>' ? TOKEN_TYPES.ID_DEVELOPMENT : TOKEN_TYPES.ID_WEBADMIN) + '&scope=openid email profile&response_type=code token&redirect_uri=' + window.location.origin + '/authcallback.html';
};