Skip to content

Commit 2917ebc

Browse files
Merge pull request #303 from supertokens/docs/changelog_migration_guide_fix
docs: fix migration guide in changelog to be consistent with node
2 parents 4021ae6 + 9ec4051 commit 2917ebc

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
107107
#### If you used the jwt feature of the session recipe
108108

109109
1. Add `ExposeAccessTokenToFrontendInCookieBasedAuth: true` to the Session recipe config on the backend if you need to access the JWT on the frontend.
110-
2. On the frontend where you accessed the JWT before by: `(await Session.getAccessTokenPayloadSecurely()).jwt` update to:
110+
2. Choose a prop from the following list. We'll use `sub` in the code below, but you can replace it with another from the list if you used it in a custom access token payload.
111+
- `sub`
112+
- `iat`
113+
- `exp`
114+
- `sessionHandle`
115+
3. On the frontend where you accessed the JWT before by: `(await Session.getAccessTokenPayloadSecurely()).jwt` update to:
111116

112117
```tsx
113118
let jwt = null;
114119
const accessTokenPayload = await Session.getAccessTokenPayloadSecurely();
115-
if (accessTokenPayload.jwt === undefined) {
120+
if (accessTokenPayload.sub !== undefined) {
116121
jwt = await Session.getAccessToken();
117122
} else {
118123
// This branch is only required if there are valid access tokens created before the update
@@ -121,12 +126,12 @@ if (accessTokenPayload.jwt === undefined) {
121126
}
122127
```
123128

124-
3. On the backend if you accessed the JWT before by `session.GetAccessTokenPayload()["jwt"]` please update to:
129+
4. On the backend if you accessed the JWT before by `session.GetAccessTokenPayload()["jwt"]` please update to:
125130

126131
```go
127132
var jwt string
128133
accessTokenPayload := session.GetAccessTokenPayload();
129-
if (accessTokenPayload["jwt"] == nil) {
134+
if (accessTokenPayload["sub"] != nil) {
130135
jwt = session.GetAccessToken();
131136
} else {
132137
// This branch is only required if there are valid access tokens created before the update

0 commit comments

Comments
 (0)