https://supertokens.com/ logo
Title
f

funk101

12/13/2022, 5:06 AM
Question about redirect after user signing in. frontendConfig(): code checks for "context.isNewUser" returns user to "select a subscription plan". Otherwise user will be redirected to a "member dashboard". At this stage, I would like to get the users "supertokens id", I'm stuck here. Is it somwhere in "context" at sign in?
r

rp

12/13/2022, 5:39 AM
hey @funk101 there is a getUserId function in the frontend SDK
f

funk101

12/13/2022, 5:40 AM
hmm
r

rp

12/13/2022, 5:40 AM
Session.getUserId
f

funk101

12/13/2022, 5:42 AM
during this?
recipeList: [
      EmailPasswordReact.init({
        getRedirectionURL: async (context) => {
          console.log("Member: ", member);
          if (context.action === "SUCCESS") {
            if (context.redirectToPath !== undefined) {
              // navigate back to where the user was before authenticated
              return context.redirectToPath;
            }
            if (context.isNewUser) {
              return "/plans";
            } else if (member.user_type === "Administrator") {
              return "/admin-dashboard";
            } else {
              return "/member-dashboard";
            }
          }

          return undefined;
        },
(excuse the left over code from experimenting
)
r

rp

12/13/2022, 5:43 AM
yea
you can call that function in here for sure - if
context.action === "SUCCESS"
is true
f

funk101

12/13/2022, 5:46 AM
ah sweet! thanks