Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-13064

kc.updateToken(…).success is not a function

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      Hide

      LINE 279 - keycloak-js

      if (initOptions.token && initOptions.refreshToken) {
                              setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken);
      
                              if (loginIframe.enable) {
                                  setupCheckLoginIframe().success(function() {
                                      checkLoginIframe().success(function (unchanged) {
                                          if (unchanged) {
                                              kc.onAuthSuccess && kc.onAuthSuccess();
                                              initPromise.setSuccess();
                                              scheduleCheckIframe();
                                          } else {
                                              initPromise.setSuccess();
                                          }
      
                                      }).error(function () {
                                          initPromise.setError();
                                      });
                                  });
                              } else {
                                  kc.updateToken(-1).success(function() { <!-- NO HANDLING OF NATIVE PROMISE
                                      kc.onAuthSuccess && kc.onAuthSuccess();
                                      initPromise.setSuccess();
                                  }).error(function() {
                                      kc.onAuthError && kc.onAuthError();
                                      if (initOptions.onLoad) {
                                          onLoad();
                                      } else {
                                          initPromise.setError();
                                      }
                                  });
                              }
                          }
      
      Show
      LINE 279 - keycloak-js if (initOptions.token && initOptions.refreshToken) { setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken); if (loginIframe.enable) { setupCheckLoginIframe().success( function () { checkLoginIframe().success( function (unchanged) { if (unchanged) { kc.onAuthSuccess && kc.onAuthSuccess(); initPromise.setSuccess(); scheduleCheckIframe(); } else { initPromise.setSuccess(); } }).error( function () { initPromise.setError(); }); }); } else { kc.updateToken(-1).success( function () { <!-- NO HANDLING OF NATIVE PROMISE kc.onAuthSuccess && kc.onAuthSuccess(); initPromise.setSuccess(); }).error( function () { kc.onAuthError && kc.onAuthError(); if (initOptions.onLoad) { onLoad(); } else { initPromise.setError(); } }); } }
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      Setting promiseType to native and then setting the token and refreshToken on .init() breaks the app since the code is not handled to use the new native promise .then()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stianst Stian Thorgersen
              Reporter:
              jiann4321 Gian Torralba (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: