important
This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.
Add a new versions of createNew/refresh/getSession without response
Status
This is just a proposal so far, it hasn't been accepted and needs further discussion.
- Status:
- proposed
- Deciders:
- rishabhpoddar, porcellus
- Proposed by:
- porcellus
- Created:
- 2022-12-13
- Last updated:
- 2023-01-13
#
Context and Problem StatementIn some cases, the BE may need to create, refresh or validate access tokens based on the token strings only, with no access to the request/response objects.
#
Considered Options- Recommend using a jwt verification lib
- Add a new functions that take/return the tokens as a strings
- Ask user to mock the req / res object passed to getSession and read tokens from that
#
Decision OutcomeWe've decided to add new functions: getSessionWithoutModifyingResponse
, refreshSessionWithoutModifyingResponse
, createNewSessionWithoutModifyingResponse
functions that take/return the tokens as a string:
- This will be very similar to the existing functions
- It should not throw, match the pattern of
{ status: "OK"; session: SessionContainer }
- We should add a
getTokensDangerously
to theSessionContainer
class, which should return all available tokens:{ accessToken: string; refreshToken: string | undefined; antiCsrf: string | undefined; frontToken: string, accessAndFrontTokenUpdated: boolean }