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
general
  • r

    rp

    12/19/2021, 11:16 AM
    @User you can check if a user is signed it or not like this: https://supertokens.io/docs/thirdpartyemailpassword/common-customizations/sessions/checking-session-front-end. If they are signed in, then you show the sign out button, else not
  • a

    aV

    12/19/2021, 4:39 PM
    @User qr code login like telegram?
  • r

    rp

    12/19/2021, 6:07 PM
    @aV we will add some version of it eventually. Just not sure when
  • i

    is

    12/19/2021, 6:16 PM
    @User I've tried https://supertokens.io/docs/thirdparty/common-customizations/sessions/checking-session-front-end
  • i

    is

    12/19/2021, 6:17 PM
    And it gives me an error, "Supertokens must be initialized first" or something
  • r

    rp

    12/19/2021, 6:17 PM
    Right. Have you called the supertokens.init function? If yes, where do you call it? It should be one of the first things that happen on app load.
  • r

    rp

    12/19/2021, 6:18 PM
    before rendering the
    ThirdPartyAuth
    component
  • i

    is

    12/19/2021, 6:18 PM
    I'm using thirdpartyauth in my index.js file
  • i

    is

    12/19/2021, 6:18 PM
    should it happen in there?
  • r

    rp

    12/19/2021, 6:18 PM
    you can, as long as you are sure to call the supertokens.init function before the
    render
    function is called.
  • i

    is

    12/19/2021, 6:19 PM
    OKay, would _app.js be a better place to call it?
  • i

    is

    12/19/2021, 6:19 PM
    Just wondering
  • r

    rp

    12/19/2021, 6:19 PM
    the init function? Yea..
  • i

    is

    12/19/2021, 6:19 PM
    I already have
    supertokensNode.init(backendConfig())
  • i

    is

    12/19/2021, 6:19 PM
    in there
  • r

    rp

    12/19/2021, 6:20 PM
    thats the backend config. You need to call the frontend init as well. See this step: https://supertokens.io/docs/thirdparty/nextjs/init#6-call-the-init-functions
  • i

    is

    12/19/2021, 6:20 PM
    if (typeof window !== 'undefined') {
      SuperTokensReact.init(frontendConfig())
    } else {
      initNode().catch(console.error)
    }
  • i

    is

    12/19/2021, 6:20 PM
    this code is already in there
  • r

    rp

    12/19/2021, 6:20 PM
    In `_app.js`:
    import SuperTokensReact from 'supertokens-auth-react'
    
    if (typeof window !== 'undefined') {
      SuperTokensReact.init(frontendConfig())
    }
  • r

    rp

    12/19/2021, 6:20 PM
    oh..
  • i

    is

    12/19/2021, 6:21 PM
    Yea not sure whats happening
  • r

    rp

    12/19/2021, 6:21 PM
    Can I see the stack trace of the error?
  • i

    is

    12/19/2021, 6:22 PM
    sure
  • r

    rp

    12/19/2021, 6:22 PM
    ah i see. you must be using
    ThirdPartyAuth
    in server side rendering.. which will not work
  • r

    rp

    12/19/2021, 6:23 PM
    See this: https://supertokens.io/docs/thirdparty/nextjs/protecting-route
  • r

    rp

    12/19/2021, 6:23 PM
    You need to wrap the call to
    ThirdPartyAuth
    with:
    dynamic(
      new Promise((res) =>
        res(ThirdParty.ThirdPartyAuth)
      ),
      { ssr: false }
    )
  • r

    rp

    12/19/2021, 6:25 PM
    So then you can do:
    <ThirdPartyAuthNoSSR requireAuth={false}>
      <ProtectedPage />
    </ThirdPartyAuthNoSSR>
  • i

    is

    12/19/2021, 6:26 PM
    ok thanks
  • i

    is

    12/19/2021, 6:26 PM
    so i believe i tried that, but what i'm trying to do is not render a signout button
  • i

    is

    12/19/2021, 6:26 PM
    and this approach redirects me to login
Powered by Linen
Title
i

is

12/19/2021, 6:26 PM
and this approach redirects me to login
View count: 2