code: private void saveTokenFromResponse(Response response) {
          try {
              JSONObject responseJSON = ((ResponseImpl)response).getResponseJSON();
  
              String accessToken = responseJSON.getString("access_token");
              String idToken = responseJSON.getString("id_token");
  
              //save the tokens
              preferences.accessToken.set(accessToken);
              preferences.idToken.set(idToken);
  
              //save the user identity separately
              String[] idTokenData = idToken.split("\\.");
              byte[] decodedIdTokenData = Base64.decode(idTokenData[1], Base64.DEFAULT);
              String decodedIdTokenString = new String(decodedIdTokenData);
              JSONObject idTokenJSON = new JSONObject(decodedIdTokenString);
  
              if (idTokenJSON.has("imf.user")) {
                  preferences.userIdentity.set(idTokenJSON.getJSONObject("imf.user"));
              }
  
              logger.debug("token successfully saved");
          } catch (Exception e) {
              throw new RuntimeException("Failed to save token from response", e);
          }
      }
docs: Extract token from response and save it locally
  @param response response that contain the token