• ?

    user

    2 years ago
    So do I need to do
    await supertokens.createNewSession(res, userObj.objectId, jwtPayload, {})
    everytime a user logs in?
  • r

    rp

    2 years ago
    If I have a user that's signed up already, how do I fetch the session information? Or do I need to create a new one everytime? In the sign up API, you will have to create a new session, and then in subsequent APIs, you will have to use our middleware to verify sessions.
    So do I need to do await supertokens.createNewSession(res, userObj.objectId, jwtPayload, {}) everytime a user logs in? Yes. Cause logging in means you verify the credentials, and then create a new session.
  • ?

    user

    2 years ago
    TypeError: Cannot read property 'hostname' of undefined
  • ?

    user

    2 years ago
    Getting this error…
  • r

    rp

    2 years ago
    Can I please see your code for the init function?
  • ?

    user

    2 years ago
    supertokens.init({ hosts: process.env.SUPERTOKEN_HOST })
  • ?

    user

    2 years ago
    SUPERTOKEN_HOST is a string
  • r

    rp

    2 years ago
    oh right. Seeing what the issue is. What version of the node lib are you using?
  • ?

    user

    2 years ago
    "supertokens-node": "^2.0.2"
  • r

    rp

    2 years ago
    ah i see. So, you are seeing the docs for version 2.1.X, but using version 2.0.X