How to refresh session payload in the client witho...
# support-questions-legacy
s
How to refresh session payload in the client without unlogging the user ? Tried attemptRefreshingSession() but still got the same payload. I've updated the session in the backend using the method 2 (https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/sessions/update-session-data)
r
Hey @splinteer
When you say refresh the payload, what exactly do you mean?
s
Hello, I mean using Session.getAccessTokenPayloadSecurely()
r
Ah okay. Use the function session.mergeIntoAccessTokenPayload to update the payload
s
This is what I did
r
Did you get back an updated front-token and sAccessToken in the response headers?
s
This is what I call in the frontend after making my request.
And this is what I call in the backend
I'm using method 2 so I don't think it's updating the headers
r
Right. So in this case it should reflect the changes after a session refresh.
If that’s not happening, I’m going to need more info - what was the access token before and after refresh?
And what is the payload supposed to look like after the refresh?
s
The payload should have a credentials property of this type: { id: string; supertokens_id: string; email: string; firstname: string; lastname: string; profile_picture: null; shop_name?: string; shop_url?: string; } I'm creating a shop so the 2 last properties should be defined
Well, it just started to work I don't know why the session was not refreshing
Maybe cache?
Thank you for your help
r
Hmmm. I’m not sure. Well. If you can replicate the issue, we can help 🙂
4 Views