Skip to content

Commit

Permalink
Add timeout option for updateToken in the js adapter.
Browse files Browse the repository at this point in the history
Closes #10514
  • Loading branch information
panuhorsmalahti committed Jul 18, 2022
1 parent 146e9e6 commit ef19cca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions adapters/oidc/js/src/keycloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ function Keycloak (config) {
kc.scope = initOptions.scope;
}

if (typeof initOptions.updateTokenTimeout === 'number') {
kc.updateTokenTimeout = initOptions.updateTokenTimeout;
}

if (typeof initOptions.messageReceiveTimeout === 'number' && initOptions.messageReceiveTimeout > 0) {
kc.messageReceiveTimeout = initOptions.messageReceiveTimeout;
} else {
Expand Down Expand Up @@ -634,6 +638,10 @@ function Keycloak (config) {
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
req.withCredentials = true;

if (kc.updateTokenTimeout) {
req.timeout = kc.updateTokenTimeout;
}

params += '&client_id=' + encodeURIComponent(kc.clientId);

var timeLocal = new Date().getTime();
Expand Down

0 comments on commit ef19cca

Please sign in to comment.