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

calling JavaScript keycloak.init() with token/refresh token leads to broken keycloak.update()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.7.0.Final, 1.8.0.CR1
    • Fix Version/s: 1.8.0.CR2, 1.9.0.CR1
    • Component/s: Adapter - JavaScript
    • Labels:
      None
    • Environment:

      Tested with Firefox/Windows, but will appear on all platforms

      Description

      Observed behaviour:

      When calling keycloak.init with token parameters

      keycloak.init({
              token: getSetting('token'),
              refreshToken: getSetting('refreshToken'),
              idToken: getSetting('idToken')
          })
      

      leaves the internal variable kc.timeSkew undefined.

      Due to this ks.isTokenExpired() will calculate expiresIn to be undefined as well, and the token will never be refreshed.

      Suggested solution: allow timeSkew to be an init parameter, and initialize it with 0 by default.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ahus1 Alexander Schwartz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: