Skip to content

Commit 90ccc1b

Browse files
Merge pull request #362 from supertokens/chore/fix_migration_in_changelog
docs: fix migration guide in changelog to be consistent with node
2 parents b9d8d52 + f160da1 commit 90ccc1b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

CHANGELOG.md

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

118118
1. Add `expose_access_token_to_frontend_in_cookie_based_auth=true` to the Session recipe config on the backend if you need to access the JWT on the frontend.
119-
2. On the frontend where you accessed the JWT before by: `(await Session.getAccessTokenPayloadSecurely()).jwt` update to:
119+
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.
120+
- `sub`
121+
- `iat`
122+
- `exp`
123+
- `sessionHandle`
124+
3. On the frontend where you accessed the JWT before by: `(await Session.getAccessTokenPayloadSecurely()).jwt` update to:
120125

121126
```tsx
122127
let jwt = null;
123128
const accessTokenPayload = await Session.getAccessTokenPayloadSecurely();
124-
if (accessTokenPayload.jwt === undefined) {
129+
if (accessTokenPayload.sub !== undefined) {
125130
jwt = await Session.getAccessToken();
126131
} else {
127132
// This branch is only required if there are valid access tokens created before the update
@@ -130,15 +135,15 @@ if (accessTokenPayload.jwt === undefined) {
130135
}
131136
```
132137

133-
3. On the backend if you accessed the JWT before by `session.get_access_token_payload()['jwt']` please update to:
138+
4. On the backend if you accessed the JWT before by `session.get_access_token_payload()['jwt']` please update to:
134139

135140
```python
136141
from supertokens_python.recipe.session.interfaces import SessionContainer
137142

138-
session: SessionContainer = ...
143+
session: SessionContainer = ...
139144
access_token_payload = await session.get_access_token_payload()
140145

141-
if access_token_payload.get('jwt') is None:
146+
if access_token_payload.get('sub') is not None:
142147
jwt = await session.get_access_token()
143148
else:
144149
# This branch is only required if there are valid access tokens created before the update

0 commit comments

Comments
 (0)