Skip to content

Commit 1673c98

Browse files
Bump jsonwebtoken to v9 on Auth0-SPA-JS v1 (#1065)
* Bump jsonwebtoken to v9 * fix test
1 parent 933e1f4 commit 1673c98

File tree

4 files changed

+49
-90
lines changed

4 files changed

+49
-90
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- run: npx concurrently --raw --kill-others --success first "npm:dev" "wait-on http://127.0.0.1:3000/ && browserstack-cypress run --build-name $CIRCLE_BRANCH"
4141
test_gatsby:
4242
docker:
43-
- image: << pipeline.parameters.docker_image >>
43+
- image: cypress/browsers:node18.12.0-chrome106-ff106
4444
working_directory: ~/repo
4545
steps:
4646
- checkout:
@@ -140,7 +140,7 @@ jobs:
140140
working_directory: my-app
141141
test_angular:
142142
docker:
143-
- image: << pipeline.parameters.docker_image >>
143+
- image: cypress/browsers:node18.12.0-chrome106-ff106
144144
working_directory: ~/repo
145145
steps:
146146
- checkout:

__tests__/jwt.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,19 @@ const createPrivateKey = () => {
2020
});
2121
};
2222

23+
const symmetricKey = 'shared secret';
24+
2325
const DEFAULT_PAYLOAD = <any>{
2426
sub: 'id|123',
2527
payload: true,
2628
nonce: verifyOptions.nonce,
2729
azp: verifyOptions.aud
2830
};
29-
const createJWT = (payload = DEFAULT_PAYLOAD, options = {}) => {
30-
const key = createPrivateKey();
31+
const createJWT = (
32+
payload = DEFAULT_PAYLOAD,
33+
options: Record<string, any> = {}
34+
) => {
35+
const key = options.algorithm === 'HS256' ? symmetricKey : createPrivateKey();
3136
return jwt.sign(payload, key, {
3237
algorithm: 'RS256',
3338
audience: verifyOptions.aud,

package-lock.json

Lines changed: 39 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"jest": "^27.3.1",
5151
"jest-junit": "^13.0.0",
5252
"jest-localstorage-mock": "^2.4.18",
53-
"jsonwebtoken": "^8.5.1",
53+
"jsonwebtoken": "^9.0.0",
5454
"oidc-provider": "^7.10.1",
5555
"prettier": "^2.4.1",
5656
"pretty-quick": "^3.1.2",

0 commit comments

Comments
 (0)