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

    linus_hologram

    02/19/2020, 6:13 PM
    would you recommend implementing something that prevents the user from having more than e.g. 2 active sessions?
  • r

    rp

    02/19/2020, 6:35 PM
    That depends on ur app’s requirement. It’s got very little to do with security.
  • l

    linus_hologram

    02/19/2020, 6:36 PM
    okay perfect thanks 🙂
  • l

    linus_hologram

    02/20/2020, 5:42 PM
    What is considered a short lived token? 10 minutes? @User
  • a

    Adiboi

    02/21/2020, 5:23 PM
    Yes, 10 minutes would be considered short lived - I'd say anything under an hour. However, its a very subjective thing.
  • a

    Adiboi

    02/21/2020, 5:23 PM
    The higher the security need, the shorter the token should be alive for
  • l

    linus_hologram

    02/22/2020, 8:19 PM
    thanks 🙂
  • l

    linus_hologram

    02/22/2020, 8:20 PM
    What should happen if I detect token theft (i.e. the refresh token would be used twice)? Should all tokens immediately be blacklisted and, thereby, the user be forced to login again?
  • r

    rp

    02/23/2020, 2:27 AM
    i would recommend that you just logout that particular session.
  • r

    rp

    02/23/2020, 2:27 AM
    but up to you.
  • l

    linus_hologram

    02/23/2020, 10:55 AM
    thanks 🙂
  • u

    user

    03/06/2020, 9:20 PM
    I ran into what I think is a bug in supertokens-website /axios. I am setting things up like this
    const HTTP = axios.create({
      baseURL: process.env.VUE_APP_API_BASE_URL,
      withCredentials: true,
      xsrfHeaderName: 'anti-csrf',
    })
    SuperTokensRequest.makeSuper(HTTP)
    but SuperTokens seems to not be aware of the baseURL when dealing with a 440 response from the server when a token is expired. I.e., when the session token expires and Supertokens automatically refreshes it, it does a request with the baseURL duplicated, e.g., it tries to access "/api/v2/api/v2/subjects" when the baseURL is set to "/api/v2" and I was trying to make a query to "/subjects".
  • r

    rp

    03/07/2020, 2:28 AM
    I see! Alright! Will see this issue. If you could please raise an issue about this on GitHub, that would be great. Thanks
  • r

    rp

    03/07/2020, 3:10 AM
    Also, if you are not using version v4+ the SuperTokens-website repo, may I know which version? So that we can fix it for that too. (Since moving from v4+ is a breaking change).
  • r

    rp

    03/07/2020, 7:06 AM
    @User we have fixed the bug where the baseURL was being ignored by our package. Please update to version
    4.0.12
    of the
    supertokens-website
    package. If you are currently using a version that is lesser than v4, then do let us know which one, so that we can fix that too (since v4 has breaking changes). Instead, if you want to migrate to the latest version of this package, please also make sure that you have updated to the latest backend SDK (because of this issue: https://github.com/supertokens/supertokens-website/issues/6). Also, I'm not sure what led you to have the issue of duplicate
    baseURL
    . If this is not solved already by our recent update, please provide the following information: - What params are you giving to the
    init
    function? - A sample API request you are making using your created axios instance Thanks!
  • u

    user

    03/10/2020, 7:49 PM
    @User I was using version 3.2.9 and am switching to 4.0.12 now.
  • r

    rp

    03/11/2020, 3:20 AM
    Alright! In that case, please also switch to the latest backend SDK.
  • r

    rp

    03/12/2020, 11:41 AM
    @User hi. Did our fix work for you?
  • r

    rp

    04/09/2020, 2:54 PM
    We have released react-native support for SuperTokens: https://supertokens.io/docs/react-native/installation @User
  • s

    Sun Walker

    04/09/2020, 3:03 PM
    > We have released react-native support for SuperTokens: https://supertokens.io/docs/react-native/installation > > @User @User Nice!
  • s

    Sun Walker

    04/11/2020, 2:08 PM
    Hey @rp if I want to store userType: 'admin' or userType: 'standard' , where should I store these?
  • r

    rp

    04/11/2020, 2:09 PM
    JwtPayload
  • r

    rp

    04/11/2020, 2:09 PM
    That way, u can get this info on each API request without having to query the db
  • r

    rp

    04/11/2020, 2:10 PM
    Give me a min. I’ll send a code snippet here so that things r clear
  • r

    rp

    04/11/2020, 2:13 PM
    So when you create a session you can do so in the following way:
    let userId = "SomeUserId";
    let jwtPayload = {userType: "admin"};
    await supertokens.createNewSession(res, userId, jwtPayload);
  • r

    rp

    04/11/2020, 2:15 PM
    And in your API you can get this info like this:
    let session = await supertokens.getSession(req, res, true);
    let userId = session.getUserId();
    let userType = session.getJWTPayload().userType
  • s

    Sun Walker

    04/11/2020, 2:15 PM
    I've got
    const payloadData = pluck(user, ['userType', 'isProvider']);
      const jwtPayload = { ...payloadData };
      const sessionData = pluck(user, ['id', 'username', 'email', 'userType', 'isProvider']);
      await createNewSession(res, user.id, jwtPayload, sessionData);
  • s

    Sun Walker

    04/11/2020, 2:15 PM
    Is that insecure at all?
  • r

    rp

    04/11/2020, 2:15 PM
    I am not sure what pluck does
  • s

    Sun Walker

    04/11/2020, 2:16 PM
    Just takes the key:value from
Powered by Linen
Title
s

Sun Walker

04/11/2020, 2:16 PM
Just takes the key:value from
View count: 2