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

    user

    04/24/2021, 11:00 AM
    cool, thanks! for now, just testing things out, no major problems with that part.
  • u

    user

    04/24/2021, 11:07 AM
    looking at the
    init
    method now. what
    apiDomain
    refers to? in my case of adding ST to a Lambda function should this API domain be the URL of the Lambda func itself?
  • r

    rp

    04/24/2021, 11:07 AM
    Yes. That is, what domain does the frontend use to reach the lambda function?
  • r

    rp

    04/24/2021, 11:08 AM
    in case of netlify / nextJS, the apiDomain is equal to the websiteDomain.
  • u

    user

    04/24/2021, 11:08 AM
    but what about
    apiDomain
    when `init`ing the backend SDK?
  • r

    rp

    04/24/2021, 11:09 AM
    it should be the same value as what's on the frontend
  • r

    rp

    04/24/2021, 11:09 AM
    you can essentially copy the same object
  • u

    user

    04/24/2021, 11:09 AM
    okay, perfect.
  • r

    rp

    04/24/2021, 11:09 AM
    that you used on the frontend
  • r

    rp

    04/24/2021, 11:09 AM
    for appInfo
  • u

    user

    04/24/2021, 11:09 AM
    then what about
    websiteDomain
    if the frontend app is still in development and not deployed anywhere yet?
  • r

    rp

    04/24/2021, 11:10 AM
    so it should be the same as whats on your frontend. If frontend is on http://localhost:8080 at the moment, then the value here should be "http://localhost:8080"
  • r

    rp

    04/24/2021, 11:11 AM
    you can use environment variables i'm assuming to determine if the function is running in dev or prod env. Based on that, you can set this value or something else.
  • u

    user

    04/24/2021, 11:11 AM
    true.
  • u

    user

    04/24/2021, 11:12 AM
    so when I deploy the frontend app and get it a real domain name, I will just have to change them again or via the env vars.
  • r

    rp

    04/24/2021, 11:12 AM
    exactly. It's best to do i with env vars
  • u

    user

    04/24/2021, 11:12 AM
    yeah, for sure.
  • r

    rp

    04/24/2021, 11:12 AM
    so that when ur developing locally, it will pick the right value
  • u

    user

    04/24/2021, 11:13 AM
    then what about
    apiBasePath
    ? what does it point to? and is it relevant for the backend part only or also for the front-?
  • r

    rp

    04/24/2021, 11:14 AM
    > then what about apiBasePath? So can you give me an example of how you would reach an API from the frontend?
  • r

    rp

    04/24/2021, 11:14 AM
    like if it's a different domain compared to the frontend, you can set it to
    /auth
    (which is the default). This means all the APIs we expose via the nodeSDK will be in
    /auth/*
    .
  • r

    rp

    04/24/2021, 11:16 AM
    If the api domain is the same as the website domain (as is the case for netlify), then the api is usually reachable via a path like
    /.netlify/functions/*
    . So we can make the apiBasePath something like
    /.netlify/functions/api
    or
    /.netlify/functions/auth
  • r

    rp

    04/24/2021, 11:17 AM
    So if you are not sure, you can give me an example of what an api call looks like from your frontend, and I can tell you what the values should be
  • u

    user

    04/24/2021, 11:18 AM
    yes, imagine the frontend calls the backend with
    https://blah-blah.execute-api.blah-blah.amazonaws.com/stage/my-endpoint
  • r

    rp

    04/24/2021, 11:19 AM
    Cool. So
    apiDomain
    should be
    https://blah-blah.execute-api.blah-blah.amazonaws.com
    and the
    apiBasePath
    should be
    /stage/auth
    . This means the node sdk will expose a bunch of APIs on
    https://blah-blah.execute-api.blah-blah.amazonaws.com/stage/auth/*
  • r

    rp

    04/24/2021, 11:20 AM
    And based on the name, I assume you will also have something like
    /prod/api-endpoint
    so the
    apiBasePath
    can be modified too based on env vars
  • u

    user

    04/24/2021, 11:21 AM
    yes, exactly.
  • u

    user

    04/24/2021, 11:22 AM
    oh man, that's great! thanks a lot! you see, if it wasn't for you many of those things would still be unclear compared to just following the docs.
  • r

    rp

    04/24/2021, 11:23 AM
    yeaaa.. clearly there is a lot of work needed in the docs! haha.. we are working on it a lot though
  • r

    rp

    04/24/2021, 11:23 AM
    and more tutorials / example videos etc..
Powered by Linen
Title
r

rp

04/24/2021, 11:23 AM
and more tutorials / example videos etc..
View count: 1