Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS-4064: Refresh Token in IDM enabled Instance does not live more tha… #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,16 @@ function SugarApi(args) {
error: onError
};

// prevents concurrent events from multiple tabs asking for a
// refresh token
if (!('crosstab' in window) || !crosstab.supported) {
console.log('------_handleErrorAndRefreshToken-------');
//console.log(localStorage.getItem('authInprogress'));
console.log('----------' + Date.now() + '----------');
// if (localStorage.getItem('authInprogress') === '1') {
// return;
// }
//localStorage.setItem('authInprogress', 1);
self.login(null, {refresh: true}, {
complete: refreshCallbacks.complete,
success: refreshCallbacks.success,
Expand All @@ -474,12 +483,21 @@ function SugarApi(args) {
var status = event.data;
switch (status) {
case 'success':
console.log('------_handleErrorAndRefreshToken-success------');
console.log('----------' + Date.now() + '----------');
//localStorage.setItem('authInprogress', 0);
refreshCallbacks.success();
break;
case 'error':
console.log('------_handleErrorAndRefreshToken-error------');
console.log('----------' + Date.now() + '----------');
//localStorage.setItem('authInprogress', 0);
refreshCallbacks.error();
break;
case 'complete':
console.log('------_handleErrorAndRefreshToken-complete------');
console.log('----------' + Date.now() + '----------');
//localStorage.setItem('authInprogress', 0);
refreshCallbacks.complete();
crosstab.off('auth:refresh:complete');
break;
Expand Down Expand Up @@ -2136,6 +2154,7 @@ module.exports = {
*/
createInstance: function(args) {
_instance = new SugarApi(args);
//localStorage.setItem('authInprogress', 0);

if (!('crosstab' in window) || !crosstab.supported) {
return _instance;
Expand All @@ -2148,6 +2167,9 @@ module.exports = {

// prevents concurrent events from multiple tabs asking for a
// refresh token
console.log('------createInstance-------');
console.log(this._runningRefreshToken);
console.log('----------' + Date.now() + '----------');
if (this._runningRefreshToken) {
return;
}
Expand Down