https://supertokens.com/ logo
Docs
Join the conversationJoin Discord
Channels
community
contributing
general
github-activity
info
introductions
new-releases
random
security
support-questions
welcome-0xdelusion
welcome-aj-ya
welcome-aleksandrc
welcome-alpinjs
welcome-amberlamps1
welcome-andrew-rodriguez
welcome-ankit-choudhary
welcome-anthony-stod-custodio
welcome-call-in
welcome-chwalbox
welcome-claybiokiller
welcome-co7e
welcome-cosmoecwsa
welcome-devdag
welcome-dinso
welcome-drebotelho
welcome-elio
welcome-ernest
welcome-foxbarrington
welcome-fromscratch
welcome-galto4ir
welcome-goetzum
welcome-hay-kot
welcome-himanshu-kukreja
welcome-hossambarakat
welcome-ichikawakazuto
welcome-jahir9991
welcome-jamesl
welcome-jerry123424
welcome-john-oliver
welcome-jonas-alexanderson
welcome-jxyz
welcome-kelvinwop
welcome-kraz
welcome-lancekey
welcome-leoo
welcome-lukeacollins
welcome-m-j-mon
welcome-malik-khoja
welcome-marco
welcome-mardadi
welcome-meshguy
welcome-metamorph
welcome-mike-tectu
welcome-mirzok
welcome-mozomig
welcome-naberyou66_
welcome-nacer
welcome-namratha
welcome-naveenkumar
welcome-nightlight
welcome-nischith
welcome-notankit
welcome-olawumi
welcome-pavan-kumar-reddy-n
welcome-pineappaul
welcome-poothebear
welcome-rick
welcome-samuel-qosenergy
welcome-samuelstroschein
welcome-shubhamgoel23
welcome-shubhamkaushal
welcome-sidebar
welcome-surajsli
welcome-suyash_
welcome-syntaxerror
welcome-tauno
welcome-tauno
welcome-tawnoz
welcome-teclali
welcome-tls
welcome-turbosepp
welcome-vikram_shadow
welcome-yann
Powered by Linen
support-questions
  • t

    teja

    01/25/2022, 6:47 AM
    yes, it seems API calls are taking 4 to 5 seconds. Initially I thought my implementation. But I tried this repo: https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens and also the ReactJS implementation. they both took similar time.
  • r

    rp

    01/25/2022, 6:50 AM
    So it seems to be the problem of cold start in serverless functions. Normally this is solved by keeping the serverless functions warm by sending a periodic ping to them.
  • r

    rp

    01/25/2022, 6:50 AM
    Also, are you using try.supertokens.io as the connection URI? That instance is located in India region and if you are not close to that, that may add further delays
  • t

    teja

    01/25/2022, 6:52 AM
    so, would it be better to have a self hosted implementation to improve the latency?
  • r

    rp

    01/25/2022, 6:52 AM
    Yea. for sure. Or you could sign up and use our managed service to deploy the core in a location closer to where the lambda functions run.
  • t

    teja

    01/25/2022, 6:54 AM
    ok got it. Thanks for the response @User . Else I would have been running in circles.
  • r

    rp

    01/25/2022, 6:55 AM
    Happy to help 🙂
  • r

    rajhans84

    01/26/2022, 2:15 AM
    Hey all, I am setting up Supertokens with Next.Js project and Flask. So my backend APIs' are running on Python flask on Http://localhost:5000/ and Next.js App is running on http://localhost:3000/. Using Managed service as Core. Followed Next.Js steps and can see the login page but when trying to signup or login I am getting CORS errors. Questions: Do I need any changes to Flask to make backend work or not? How to fix CORS errors? Please advise. Thanks in Advance.
    r
    k
    114 replies · 3 participants
  • r

    rajhans84

    01/26/2022, 2:26 AM
    NextJs_Flask Setup Questions
  • m

    miguelcobain

    01/26/2022, 11:05 PM
    Hi everyone. 👋 I hosted my supertokens core behind a reverse proxy at example.com/supertokens. I'm using
    connectionURI: 'https://example.com/supertokens/'
    , but it seems like my backend is trying to make requests like
    https://example.com/apiversion
    . Does supoertokens support using a base path/prefix for the connectionURI? Seems like it is ignored.
  • r

    rp

    01/27/2022, 4:28 AM
    @User we don't support base path for the connection URI :(. You will have to give a sub domain for the core. If you'd like this feature, please feel free to open an issue about this on our github.
  • m

    miguelcobain

    01/27/2022, 5:09 PM
    Is there any examples of using supertokens with a custom UI for us non-react users? I'm having a hard time with that.
  • r

    rp

    01/27/2022, 5:11 PM
    Hey! there is a blog post about how to setup social login with custom UI that might help: https://supertokens.com/blog/adding-social-login-to-your-website-with-supertokens We are also working on a non react SDK which will provide helper functions like
    signIn
    ,
    signUp
    etc so that you don't have to make API calls manually.
  • m

    miguelcobain

    01/27/2022, 5:20 PM
    @User so, I'm making a POST to
    /auth/signin
    with
    rid: 'emailpassword'
    header. I do get back a 200 with the json and the tokens in the set-cookie response headers. However, I'm a bit lost on what I should do after that. More specifically,
    await SuperTokens.doesSessionExist()
    returns false.
  • r

    rp

    01/27/2022, 5:22 PM
    Have you called init on the supertokens-website repo? ANd on the backend, have you added session.init()? Perhaps you can share your frontend and backend config here.
  • m

    miguelcobain

    01/27/2022, 5:24 PM
    @User Here you go. Context: I'm trying to use the JWT feature to integrate with Hasura. Frontend config:
    js
    SuperTokens.init({
      apiBasePath: '/api/auth',
      apiDomain: 'https://my.website.com'
    });
    Backend config:
    js
    supertokens.init({
      framework: 'fastify',
      supertokens: {
        connectionURI: process.env.SUPERTOKENS_URL,
        apiKey: process.env.SUPERTOKENS_API_KEY
      },
      appInfo: {
        appName: 'My Website',
        apiDomain: 'https://my.website.com',
        websiteDomain: 'https://my.website.com',
        apiGatewayPath: '/api'
      },
      recipeList: [
        EmailPassword.init(),
        Session.init({
          jwt: {
            enable: true
          }
        })
      ]
    });
  • r

    rp

    01/27/2022, 5:25 PM
    You need to set
    apiBasePath
    on the backend as well.
  • r

    rp

    01/27/2022, 5:25 PM
    to
    /api/auth
    . And you can remove
    apiGatewayPath
    (unless you are using something like AWS's staging environment.
  • m

    miguelcobain

    01/27/2022, 5:26 PM
    So, here's the situation, my backend is at
    https://my.website.com/api
    , which means that supertokens endpoints are at
    https://my.website.com/api/auth
  • r

    rp

    01/27/2022, 5:27 PM
    Yes. So you need to set
    apiBasePath
    on both frontend and backend to
    /api/auth
  • r

    rp

    01/27/2022, 5:27 PM
    And you can remove
    apiGatewayPath
  • r

    rp

    01/27/2022, 5:27 PM
    Then try again
  • m

    miguelcobain

    01/27/2022, 5:31 PM
    @User the problem is that now my endpoints are at
    https://my.website.com/api/api/auth
  • m

    miguelcobain

    01/27/2022, 5:31 PM
    That's why I used
    apiGatewayPath
    .
  • m

    miguelcobain

    01/27/2022, 5:33 PM
    I guess the frontend supertokens needs an
    apiGatewayPath
    as well, but I don't think that's an option.
  • r

    rp

    01/27/2022, 5:48 PM
    That's odd. Using this on the backend config:
    appInfo: {
        appName: 'My Website',
        apiDomain: 'https://my.website.com',
        websiteDomain: 'https://my.website.com',
        apiBasePath: '/api/auth',
      },
    Will expose the APIs on
    https://my.website.com/api/auth
  • m

    miguelcobain

    01/27/2022, 5:48 PM
    @User Yes, but that assumes that the backend is running at root
  • r

    rp

    01/27/2022, 5:48 PM
    ah i see.. okay. So the backend doesn't see
    /api
    part
  • m

    miguelcobain

    01/27/2022, 5:48 PM
    Exactly.
  • r

    rp

    01/27/2022, 5:48 PM
    it will only see
    /auth
Powered by Linen
Title
r

rp

01/27/2022, 5:48 PM
it will only see
/auth
View count: 2