Demna
05/31/2022, 8:46 AMhttp://localhost:8080
as the allowed origin when enabling CORS for my API Gateway (for both /user
and /auth
resources), I still get what appears to be a CORS error.
The first, OPTIONS
request returns code 403 Forbidden, saying, CORS Missing Allow Origin
. The second, POST
request says, NS_ERROR_DOM_BAD_URI
.
On the other hand, when testing the API from the online tool, https://hoppscotch.io — which, from what I understand, sends the request from its own domain — it's received perfectly fine. What's up with that?nkshah2
05/31/2022, 8:48 AMDemna
05/31/2022, 8:49 AMDemna
05/31/2022, 8:51 AMjs
button.addEventListener("click", async () => {
const output = {
formFields: [
{ id: "email", value: email.value },
{ id: "password", value: password.value },
],
};
// fetch(API_URL, {
fetch(`${window.apiDomain}/auth/signup?apiBasePath=auth`, {
method: "POST",
credentials: "include",
headers: {
"Content-Type": "application/json",
rid: "thirdpartyemailpassword",
},
body: JSON.stringify(output),
});
});
nkshah2
05/31/2022, 8:51 AMDemna
05/31/2022, 8:53 AMjs
const ThirdPartyEmailPassword = require("supertokens-node/recipe/thirdpartyemailpassword");
const Session = require("supertokens-node/recipe/session");
function getBackendConfig() {
return {
framework: "awsLambda",
supertokens: {
connectionURI: "https://try.supertokens.com",
},
appInfo: {
appName: "Supertokens Demo",
apiDomain: "https://8qae7drptf.execute-api.eu-central-1.amazonaws.com",
websiteDomain: "http://localhost:8080",
apiBasePath: "/auth",
websiteBasePath: "/auth",
apiGatewayPath: "/dev"
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [...],
}),
Session.init(),
],
isInServerlessEnv: true,
}
}
module.exports.getBackendConfig = getBackendConfig;
Demna
05/31/2022, 8:53 AMproviders
or else the message was too long to send.Demna
05/31/2022, 8:54 AMnkshah2
05/31/2022, 8:59 AM/dev/auth
and not /auth
directly? In the backend config you have set the gateway path to be /dev
Demna
05/31/2022, 9:00 AMDemna
05/31/2022, 9:01 AMnkshah2
05/31/2022, 9:01 AMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by