Skip to content

[Docs]: Confusion regarding the SUPERTOKENS_* env variables in generated code #9753

@suzdalnitski

Description

@suzdalnitski

Summary and description

Running yarn rw setup auth supertokens generates code:

const websiteDomain =
  process.env.SUPERTOKENS_WEBSITE_DOMAIN || 'http://localhost:8910'
const apiDomain = process.env.SUPERTOKENS_API_DOMAIN || websiteDomain
const apiGatewayPath =
  process.env.SUPERTOKENS_API_GATEWAY_PATH || '/.redwood/functions'

However the Supertokens auth guide includes only the following:

SUPERTOKENS_JWKS_URL=http://localhost:8910/.redwood/functions/auth/jwt/jwks.json
SUPERTOKENS_CONNECTION_URI=https://try.supertokens.io

What is the jwks.json file? From what I can tell it is being generated dynamically? I was somewhat confused when I haven't seen that file within the repo. Probably worth mentioning this in the docs.

Another issue, the docs don't mention the env variables that have to be set, based on the generated code. I assume the defaults are going to be working fine in dev, but what about production?

In particular this is not entirely clear:

  1. SUPERTOKENS_WEBSITE_DOMAIN - this has to be set to the url of the web side when deployed? eg https://www.myapp.com
  2. SUPERTOKENS_API_DOMAIN - does it have to be set to the api side url? https://api.myapp.com? And why does it default to websiteDomain?
  3. What exactly is SUPERTOKENS_API_GATEWAY_PATH, and why does it default to /.redwood/functions? Can it be set to the api url?

Are you interested in working on this?

  • I'm interested in working on this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions