Skip to content

Commit

Permalink
Merge pull request #31 from keycloakify/extraQueryParams_in_renewTokens
Browse files Browse the repository at this point in the history
Extra query params in renew tokens
  • Loading branch information
garronej authored Sep 23, 2024
2 parents a06808e + c4d0047 commit 414ea69
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 25 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oidc-spa",
"version": "5.2.8",
"version": "5.3.0-rc.1",
"description": "Openidconnect client for Single Page Applications",
"repository": {
"type": "git",
Expand Down Expand Up @@ -55,11 +55,11 @@
"evt": "^2.5.7",
"husky": "^4.3.8",
"jsonwebtoken": "^9.0.2",
"jwt-decode": "3.1.2",
"jwt-decode": "4.0.0",
"lint-staged": "^11.1.1",
"node-fetch": "2.7.0",
"@types/node-fetch": "2.6.11",
"oidc-client-ts": "2.4.0",
"oidc-client-ts": "3.0.1",
"prettier": "^2.8.8",
"react": "^18.2.0",
"ts-node": "^10.9.1",
Expand Down
10 changes: 7 additions & 3 deletions src/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export declare namespace Oidc {
export type LoggedIn<DecodedIdToken extends Record<string, unknown> = Record<string, unknown>> =
Common & {
isUserLoggedIn: true;
renewTokens(): Promise<void>;
renewTokens(params?: { extraTokenParams?: Record<string, string> }): Promise<void>;
getTokens: () => Tokens<DecodedIdToken>;
subscribeToTokensChange: (onTokenChange: () => void) => { unsubscribe: () => void };
logout: (
Expand Down Expand Up @@ -1405,10 +1405,14 @@ export async function createOidc<
});
return new Promise<never>(() => {});
},
"renewTokens": async () => {
"renewTokens": async params => {
const { extraTokenParams } = params ?? {};

assertSessionStorageNotCleared();

const oidcClientTsUser = await oidcClientTsUserManager.signinSilent();
const oidcClientTsUser = await oidcClientTsUserManager.signinSilent({
extraTokenParams
});

assert(oidcClientTsUser !== null);

Expand Down
4 changes: 2 additions & 2 deletions src/tools/decodeJwt.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import { jwt_decode } from "../vendor/frontend/oidc-client-ts-and-jwt-decode";
export const decodeJwt = jwt_decode;
import { jwt_decode_ns } from "../vendor/frontend/oidc-client-ts-and-jwt-decode";
export const decodeJwt = jwt_decode_ns.jwtDecode;
2 changes: 0 additions & 2 deletions src/vendor/frontend/oidc-client-ts-and-jwt-decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ export * from "oidc-client-ts";

import * as jwt_decode_ns from "jwt-decode";
export { jwt_decode_ns };
import jwt_decode from "jwt-decode";
export { jwt_decode };
24 changes: 9 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1718,11 +1718,6 @@ cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"

crypto-js@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631"
integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==

csstype@^3.0.2:
version "3.1.3"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
Expand Down Expand Up @@ -2367,10 +2362,10 @@ jws@^3.2.2:
jwa "^1.4.1"
safe-buffer "^5.0.1"

jwt-decode@3.1.2, jwt-decode@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==
jwt-decode@4.0.0, jwt-decode@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-4.0.0.tgz#2270352425fd413785b2faf11f6e755c5151bd4b"
integrity sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==

kind-of@^6.0.2:
version "6.0.3"
Expand Down Expand Up @@ -2609,13 +2604,12 @@ object-keys@^1.1.1:
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==

oidc-client-ts@2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/oidc-client-ts/-/oidc-client-ts-2.4.0.tgz#764c8a33de542026e2798de9849ce8049047d7e5"
integrity sha512-WijhkTrlXK2VvgGoakWJiBdfIsVGz6CFzgjNNqZU1hPKV2kyeEaJgLs7RwuiSp2WhLfWBQuLvr2SxVlZnk3N1w==
oidc-client-ts@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/oidc-client-ts/-/oidc-client-ts-3.0.1.tgz#be264fb87c89f74f73863646431c32cd06f5ceb7"
integrity sha512-xX8unZNtmtw3sOz4FPSqDhkLFnxCDsdo2qhFEH2opgWnF/iXMFoYdBQzkwCxAZVgt3FT3DnuBY3k80EZHT0RYg==
dependencies:
crypto-js "^4.2.0"
jwt-decode "^3.1.2"
jwt-decode "^4.0.0"

once@^1.3.0:
version "1.4.0"
Expand Down

0 comments on commit 414ea69

Please sign in to comment.