Skip to main content
important

This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.

Combine doesSessionExist and validateClaims into a single function

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-11-28

Context and Problem Statement#

Apps have to call both doesSessionExist and validateClaims to completely check if the user should access a page. We want to make this simpler.

Considered Options#

  • Improve documentation
  • Add function that combines both calls

Decision Outcome#

Add a combined function (hasAccess):

  • new function to web-js that combines doesSessionExists and validateClaims
  • no redirection
  • Returns: { hasAccess: true } | {hasAccess: false, invalidClaims: [], sessionExists: boolean}

Reasons:

  • A separate validateClaims is just too easy to forget.