marshmalon
04/11/2022, 10:36 PMrp_st
04/12/2022, 3:59 AMcreateNewSession
and getSession
recipe functions of the session recipe.
When making a request from the chrome extension, you can add some custom header indicating it's a chrome extension and then override the createNewSession
function on the backend to check if this header is present. If it is, then you can create a JWT in that function and attach that to the response headers. Else, you can call the originalImplementation (for nextJS)
When overriding getSession
, you can check if the input is a JWT authorisation bearer token. If it is, you can verify that using any JWT verification lib and return a session object. Else you can call the call the originalImplementation (for nextJS).
Docs that you might need for this:
- https://supertokens.com/docs/session/advanced-customizations/backend-functions-override/usage
- https://supertokens.com/docs/thirdpartyemailpassword/advanced-customizations/user-context
(Im not sure which recipe you are using, but the above one is for session + thirdpartyemailpassword)marshmalon
04/12/2022, 4:06 AMrp_st
04/12/2022, 4:07 AM