Skip to content

Commit

Permalink
Merge upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sync Fork committed Feb 22, 2024
1 parent e92007f commit e7e1815
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-panthers-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@nhost/hasura-auth-js': patch
---

fix(hasura-auth-js): replace `jwt-decode` with `jose` for decoding access tokens that works on both the browser and Node.js
2 changes: 1 addition & 1 deletion packages/hasura-auth-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"dependencies": {
"@simplewebauthn/browser": "^6.2.2",
"fetch-ponyfill": "^7.1.0",
"jose": "^5.2.2",
"js-cookie": "^3.0.5",
"jwt-decode": "^3.1.2",
"xstate": "^4.38.3"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/hasura-auth-js/src/hasura-auth-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import jwt_decode from 'jwt-decode'
import * as jose from 'jose'
import { interpret } from 'xstate'
import {
EMAIL_NEEDS_VERIFICATION,
Expand Down Expand Up @@ -625,7 +625,7 @@ export class HasuraAuthClient {
public getDecodedAccessToken(): JWTClaims | null {
const jwt = this.getAccessToken()
if (!jwt) return null
return jwt_decode<JWTClaims>(jwt)
return jose.decodeJwt<JWTClaims>(jwt)
}

/**
Expand Down
10 changes: 7 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e7e1815

Please sign in to comment.