https://supertokens.com/
Join Discord
Are the frontend auth routes from the NextJS SDK Next-specific or able to be used with any backend a...
m

mlegls

about 3 years ago
Are the frontend auth routes from the NextJS SDK Next-specific or able to be used with any backend as long as the config is set correctly? As far as I can tell it seems like everything just uses the same stuff from the React package, with some extra stuff added for routing & SSR support But... I'm deploying on Vercel with a Next frontend but a backend api written in a different language (Python, FastAPI), and I can NOT get APIs nor signout to work correctly for some reason. Signup and signin works fine, but trying to call any backend service from the browser with an axios request throws 401. I've tried wrapping axios outside the component function and inside useEffect(..., []). Also, after calling logout, going to /auth again doesn't redirect to the signin screen unless I manually clear browser cookies. Protecting a page with the ThirdPartyEmailPasswordAuthNoSSR also doesn't redirect to signin after I've signed out, unless I manually clear the cache. The backend endpoints work fine when tested from Insomnia. I thought it might just be an issue with dev mode but I've tried fully building it too.
m
r
  • 2
  • 33
  • 4
Hi, so I am using the Next.js implementation with TypeScript, but in the API routes, I saw the tutor...
a

alan the guy

over 3 years ago
Hi, so I am using the Next.js implementation with TypeScript, but in the API routes, I saw the tutorial set the
req
and
res
to
any
, is there any way so that I can still use Next.js API types? The tutorial: https://supertokens.com/docs/emailpassword/nextjs/session-verification/in-api
a
r
  • 2
  • 3
  • 4
Hi everyone. I am using SuperToken with nestjs, I am trying out the api override feature to customis...
a

andrewlee1123

over 3 years ago
Hi everyone. I am using SuperToken with nestjs, I am trying out the api override feature to customise the signup flow. I have the auth module from the docs, I created auth.service inside the module. Inside the auth.service, I created a method called signUp and a private method isEmailSupported, then I inject the auth.service into supertokens.service and set the signUp function to the value of the signUpPOST key. When I trigger the signup, I got an error from nestjs, saying that "this.isEmailSupported is not a function". Is it a supertoken specific problem or nestjs problem?
a
r
  • 2
  • 12
  • 4
Hi guys! I'm fresh to supertokens and have been trying to find out how I can manually create users b...
h

hoffeman

over 3 years ago
Hi guys! I'm fresh to supertokens and have been trying to find out how I can manually create users backend? I'm creating a service that import users and does not allow sign up. Would I have to call the core directly or can I use the node SDK?
h
r
  • 2
  • 4
  • 4
Hi there, these are the cookies I have in the browser when I'm (supposed to be) signed in. https://p...
f

fragordie

over 3 years ago
Hi there, these are the cookies I have in the browser when I'm (supposed to be) signed in. https://prnt.sc/0-c7XPkIYqoh Is this correct? If yes, then why do I get this response on auth/me? https://prnt.sc/s29fUDnToVcg
f
r
  • 2
  • 44
  • 4
Hey, i added a password confirm input field to the signup form. I didn't find any documented way to ...
t

TELYA

over 3 years ago
Hey, i added a password confirm input field to the signup form. I didn't find any documented way to validate with another field (password) so i did this way:
typescript
let password = "";
SuperTokensReact.init({
  config...,
  signInAndUpFeature: {
    signUpForm: {
      formFields: [
       {
        id:"passwordConfirm",
        validate: async(value:string) => {
          if (value !== password) {
            return "error msg";
          }
          return undefined;
        }
       },
       {
        id: "password",
        validate: async(value:string) => {
          password = value;
          return undefined;  
        }
       }
      ]
    }
  }     
})
My question to this. Is it any better way to accomplish this ? My second problem with this newly created input field is the input type. I got text but i would like to changed this to password, so i did this:
typescript
  EmailPasswordReact.init({
    override:{
      components:{
         EmailPasswordSignUpForm_Override:({DefaultComponent}) => {
           useEffect(() => {
             const passwordConfirm = document.querySelector<HTMLInputElement>('.supertokens-input[name="passwordConfirm"]');

             if (passwordConfirm && passwordConfirm.type === "text") {
               passwordConfirm.setAttribute("type", "password");
             }
           }, []);
           return <DefaultComponent {...props} />;
         }
      }
    }
  })
It worked, but i feel this is not the right way to do it. So is it any better way to do this ? Thanks for the answers in advance 🙂 Btw i really like the stuff that you guys created 🤘
t
r
  • 2
  • 2
  • 4
Is there somewhere a guide on how to implement email verification for plain javascript?
m

Maxi|Shinobi

over 3 years ago
Is there somewhere a guide on how to implement email verification for plain javascript?
m
r
  • 2
  • 43
  • 4
Hello! Very first time user here. Is there some kind of administration panel available for SuperToke...
j

joshpennington

over 3 years ago
Hello! Very first time user here. Is there some kind of administration panel available for SuperTokens or is SuperTokens only an API?
j
r
  • 2
  • 2
  • 4
can you help me with this first - How to add hasura custom claims , how it will work out for JWT'...
y

Yogeshwar

over 3 years ago
can you help me with this first - How to add hasura custom claims , how it will work out for JWT's , since docs mentioned below are using accessTokenPayload https://supertokens.com/docs/passwordless/hasura-integration/with-jwt#3--add-custom-claims-to-the-jwt
y
r
  • 2
  • 12
  • 4
Does anyone know why `const {userId} = useSessionContext();` would return `DEFAULT_USER_ID`?
a

Astro

over 3 years ago
Does anyone know why
const {userId} = useSessionContext();
would return
DEFAULT_USER_ID
?
a
r
  • 2
  • 29
  • 4
Previous122123124Next

SuperTokens.com

SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).

Powered by