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
  • v

    Vetro

    12/23/2021, 1:45 PM
    no, only
    401 unauthorized
  • r

    rp

    12/23/2021, 1:45 PM
    A sample refresh API call looks like this:
    curl 'https://localhost:3000/auth/session/refresh' \
      -X 'POST' \
      -H 'rid: session' \
      -H 'Cookie: sRefreshToken=ATa8vaSYm3PvteMeAnAuAE3a8tV0WlQDArCkhVmnkVIPthrHsdDpymIEssv%2BKXn5OSABMc%2Fw5zofn9Q%2BjKEs53rSf5A%2Bobxr7%2BBqTR9qOQO%2Bu8f7IozxMuY1KfwDiMKYOZRYjOW7BT5RE9E1kuOvcigqog5hNvyp1mYqF9VgO4Oho1mhX0s%2BjL5RV7ZdLN3RKqVrZQVm35Cy%2FqUvG7e7zhtMYX5AMSecA8OnZ7X%2By4VVnf7opkmy4L5UiWgmvUuVGZJ0OJwYRSCYpKyzYhso1LVFiTA6hXeStghiXaDMsNtgnXqktbk8JXnD4npOe3dVm3hlBZvOd0ol7beCoNvDaKFEgCEemZjBCL8BdsMtQ%2BYL2OOsiySBua57gumIhXIOp2AKb7tBIo15vqgB.02eddfb35c1e47b62defad9fd2a0517ece5b8e744df214916eb534cf289e0306.V2; sIdRefreshToken=0db5d679-7a7f-4d06-9cec-f3778aa0b2f7'
  • r

    rp

    12/23/2021, 1:47 PM
    Also, are you trying to refresh the session in the backend?
  • r

    rp

    12/23/2021, 1:47 PM
    or from the frontend?
  • v

    Vetro

    12/23/2021, 1:47 PM
    I'm trying to do it at SSR, so its neither frontend or backend
  • v

    Vetro

    12/23/2021, 1:48 PM
    at frontend refreshing works perfectly
  • r

    rp

    12/23/2021, 1:48 PM
    So you want to do a refresh only from the frontend, and never from the web server
  • r

    rp

    12/23/2021, 1:48 PM
    If you see that the access token has expired during SSR, you should send a "loading" screen to the frontend
  • r

    rp

    12/23/2021, 1:49 PM
    which will manually refresh the session, and then reload the page
  • r

    rp

    12/23/2021, 1:50 PM
    ANd you can manually refresh the session on the frontend via
    await Session.attemptRefreshingSession()
  • r

    rp

    12/23/2021, 1:50 PM
    See nextJS SSR guide for reference: https://supertokens.io/docs/thirdpartyemailpassword/nextjs/session-verification/in-ssr (if this helps..)
  • v

    Vetro

    12/23/2021, 1:51 PM
    hm, yes, but at the moment I don't know how to do it properly... on NUXT, (not next) the asyncData push me immediatelly at error page if something goes wrong at ssr :/
  • r

    rp

    12/23/2021, 1:52 PM
    Yea i know Nuxt. haha... but since we don't have a guide for that, I sent you next's ssr guide 😅
  • r

    rp

    12/23/2021, 1:52 PM
    How do you do session verification during SSR?
  • v

    Vetro

    12/23/2021, 1:53 PM
    im passing the header with cookies to backend and its doing a verification
  • r

    rp

    12/23/2021, 1:53 PM
    are you using
    verifySession
    function in the backend?
  • v

    Vetro

    12/23/2021, 1:54 PM
    yes
  • r

    rp

    12/23/2021, 1:54 PM
    So you should instead use
    getSession
    like shown in the nExt JS guide like above
  • r

    rp

    12/23/2021, 1:55 PM
    and catch try referesh token errors and send the loading page as a reply
  • r

    rp

    12/23/2021, 1:55 PM
    which should then manually refresh the session and reload the page -> this time the new access token will be sent and your backend SSR will succeed.
  • v

    Vetro

    12/23/2021, 1:57 PM
    ok, will try to do it, thank you for your time, will write if I'll have more questions
  • r

    rp

    12/23/2021, 1:57 PM
    Sure! I'll be happy to help 🙂
  • v

    Vetro

    12/23/2021, 1:57 PM
    have a nice christmas 🙂
  • r

    rp

    12/23/2021, 1:57 PM
    to you too! :))
  • g

    gaurang7

    12/23/2021, 2:30 PM
    I need help understanding my express server not registering API's i.e. signup & sign in etc Cannot POST /auth/signup
  • r

    rp

    12/23/2021, 2:30 PM
    Did you follow the backend quick setup guide?
  • g

    gaurang7

    12/23/2021, 2:30 PM
    yeah
  • r

    rp

    12/23/2021, 2:30 PM
    Which recipe are you using?
  • g

    gaurang7

    12/23/2021, 2:32 PM
    email & password login
  • r

    rp

    12/23/2021, 2:32 PM
    So did you follow all steps in this? https://supertokens.io/docs/emailpassword/quick-setup/backend
Powered by Linen
Title
r

rp

12/23/2021, 2:32 PM
So did you follow all steps in this? https://supertokens.io/docs/emailpassword/quick-setup/backend
View count: 2