You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Tries to validate an access token and build a Session object from it.
330
+
331
+
Notes about anti-csrf checking:
332
+
- if the `antiCsrf` is set to VIA_HEADER in the Session recipe config you have to handle anti-csrf checking before calling this function and set antiCsrfCheck to false in the options.
333
+
- you can disable anti-csrf checks by setting antiCsrf to NONE in the Session recipe config. We only recommend this if you are always getting the access-token from the Authorization header.
334
+
- if the antiCsrf check fails the returned status will be TRY_REFRESH_TOKEN_ERROR
335
+
336
+
args:
337
+
- access_token: The access token extracted from the authorization header or cookies
338
+
- anti_csrf_token: The anti-csrf token extracted from the authorization header or cookies. Can be undefined if antiCsrfCheck is false
339
+
- anti_csrf_check: If true, anti-csrf checking will be done. If false, it will be skipped. Defaults behaviour to check.
340
+
- check_database: If true, the session will be checked in the database. If false, it will be skipped. Defaults behaviour to skip.
341
+
- override_global_claim_validators: Alter the
342
+
- user_context: user context
343
+
344
+
Returned values:
345
+
- GetSessionOkResult: The session was successfully validated, including claim validation
346
+
- GetSessionClaimValidationErrorResult: While the access token is valid, one or more claim validators have failed. Our frontend SDKs expect a 403 response the contents matching the value returned from this function.
347
+
- GetSessionTryRefreshTokenErrorResult: This means, that the access token structure was valid, but it didn't pass validation for some reason and the user should call the refresh API.
348
+
- You can send a 401 response to trigger this behaviour if you are using our frontend SDKs
349
+
- GetSessionUnauthorizedErrorResult: This means that the access token likely doesn't belong to a SuperTokens session. If this is unexpected, it's best handled by sending a 401 response.
0 commit comments