Comments (10)
SUPERTOKENS_WEBSITE_DOMAIN - this has to be set to the url of the web side when deployed? eg https://www.myapp.com
That is correct.
SUPERTOKENS_API_DOMAIN - does it have to be set to the api side url?
Yes.
And why does it default to websiteDomain?
Cause in the local deployment of redwood, the website domain and api domain are both on localhost:8910
. The api has a path of .redwood/functions
as far as i remember. This means that the auth apis for sign in etc, are exposed on .redwood/functions/auth/signin
, where the gateway path is .redwood/functions/
and the auth related apis are further scoped by /auth
(known as apiBasePath
)
What exactly is SUPERTOKENS_API_GATEWAY_PATH, and why does it default to /.redwood/functions?
You can read more about this here.
Can it be set to the api url
Nope. The config for api url is called SUPERTOKENS_API_DOMAIN
At least in dev mode, setting SUPERTOKENS_API_DOMAIN to http://localhost:8911 results in CORS issues when trying to use Supertokens. Does it mean that the value has to be entirely omitted?
Can you share the cors error? This is unexpected.
Not setting the env var results in an exception getting thrown on the api side
If you are using our managed service, there is an api key, but if you use a self hosted route, then there is no API key (by default). Either way, I think it makes sense to add a new env var SUPERTOKENS_API_KEY
which can be ""
by default (works for self hosted with no api key configured).
from redwood.
At least in dev mode, setting SUPERTOKENS_API_DOMAIN
to http://localhost:8911
results in CORS issues when trying to use Supertokens. Does it mean that the value has to be entirely omitted?
So far it seems that the only values thave to be be set are SUPERTOKENS_WEBSITE_DOMAIN
, SUPERTOKENS_JWKS_URL and SUPERTOKENS_CONNECTION_URI
from redwood.
And it also seems that we have to set SUPERTOKENS_API_KEY
, which is missing from the generated code (and the docs):
supertokens: {
connectionURI: env.SUPERTOKENS_CONNECTION_URI,
apiKey: env.SUPERTOKENS_API_KEY, # !!!
},
Not setting the env var results in an exception getting thrown on the api side.
from redwood.
Hi @suzdalnitski - it looks like SuperTokens may have changed their implementation and the setup commands are not up to date and the Redwood setup guide they had as part of the docs is no longer present.
Edit: note the implementation hasn’t changed - just need to clarify the config.
I'll have to reconnect with their team and see what needs to be done to support the Node backend and React front end apis now offered.
from redwood.
I think it makes sense to add a new env var
SUPERTOKENS_API_KEY
which can be""
by default (works for self hosted with no api key configured).
Ah that’s a good idea. Thanks!
from redwood.
At least in dev mode, setting SUPERTOKENS_API_DOMAIN to http://localhost:8911 results in CORS issues when trying to use Supertokens. Does it mean that the value has to be entirely omitted?
Can you share the cors error? This is unexpected.
Not setting the env var results in an exception getting thrown on the api side
Access to fetch at 'http://localhost:8911/.redwood/functions/auth/authorisationurl?thirdPartyId=google&redirectURIOnProviderDashboard=http%3A%2F%2Flocalhost%3A8910%2Fauth%2Fcallback%2Fgoogle' from origin 'http://localhost:8910' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
This goes away if SUPERTOKENS_API_DOMAIN=http://localhost:8910
.
Looking at this one more time, it seems that the url isn't entirely correct - http://localhost:8911/.redwood/functions/auth
should probably be http://localhost:8911/auth
?
I think this default may be the reason for that:
const apiGatewayPath = process.env.SUPERTOKENS_API_GATEWAY_PATH || '/.redwood/functions'
from redwood.
And why does it default to websiteDomain?
Cause in the local deployment of redwood, the website domain and api domain are both on
localhost:8910
. The api has a path of.redwood/functions
as far as i remember.
If I'm not mistaken, it is both http://localhost:8911
and http://localhost:8910/.redwood/functions
(the framework internally rewrites calls to .redwood/functions
to the API side which runs on :8911). But I may be wrong since I'm not too familiar with the internals of Redwood.
from redwood.
I was able to get it all working locally/in prod, and updated the docs/templates with my learnings: https://github.com/redwoodjs/redwood/pull/9757/files
from redwood.
Thanks @suzdalnitski !
Looking at this one more time, it seems that the url isn't entirely correct - http://localhost:8911/.redwood/functions/auth should probably be http://localhost:8911/auth?
At the time of integration, the edge functions would run on /.redwood/functions/*
. However, I'm not sure how this might have changed now. But the point is, the apiGatewayPath + apiBasePath should point to the API layer in which the supertokens middleware resides.
from redwood.
Docs provided by #9757 help clarify the SuperTokens setup.
from redwood.
Related Issues (20)
- [Docs]: how functions work in a PaaS environments like Render.com HOT 4
- [Docs]: Chapter 5 of the Tutorial uses an old format of Storybook HOT 1
- [Bug?]: `yarn rw test` causes antivirus program to warn me about access to folder on Mac OS HOT 14
- [Docs]: <Set private> is deprecated, used within Router docs HOT 1
- [Bug?]: Generators Cannot read properties of undefined (reading 'startsWith') HOT 5
- [Bug?]: Invalid SDL generated with certain Prisma models that lack editable fields HOT 2
- [Bug?]: Prisma Model with Bytes field fails SDL generation in Service Test template HOT 4
- [Bug]: Cell generation does not support the Custom Prisma Id Field that Scaffolding Supports
- [Bug?]: FastifyError [Error]: The decorator 'urlData' has already been added! HOT 2
- [Docs]: Firebase setup
- [Docs]: Authentication and routes HOT 1
- Change auth impersonation in Studio to not use Request body HOT 1
- Error in Redwood Studio HOT 6
- [Bug]: yarn create redwood-app ... stopped by ERR_IMPORT_ASSERTION_TYPE_MISSING HOT 4
- [Bug?]: url search parameter is erased if originated from outside the app (via redirection) HOT 4
- [Bug?]: the teardown in jest.setup is attempting to delete data from views HOT 2
- [Bug]: Error: ENOENT: no such file or directory when deleting page directory HOT 1
- [Bug?]: Routes should use encodeURIComponent when appending unnamed params HOT 1
- [RFC]: Update Metadata to include google structured data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redwood.