davido_k
02/25/2023, 10:35 PMstate
and a code
value
Everything seems like it should work.rp_st
02/26/2023, 5:35 AMdavido_k
02/26/2023, 5:35 AMrp_st
02/26/2023, 5:38 AMrp_st
02/26/2023, 5:38 AMrp_st
02/26/2023, 5:38 AMdavido_k
02/26/2023, 5:48 AMimport { superTokensNextWrapper } from "supertokens-node/nextjs"
import { middleware } from "supertokens-node/framework/express"
import supertokens from "supertokens-node"
import { backendConfig } from "../../../config/backendConfig"
import NextCors from "nextjs-cors"
import { websiteDomain } from "../../../config/appInfo"
supertokens.init(backendConfig())
export default async function superTokens(req, res) {
// NOTE: We need CORS only if we are querying the APIs from a different origin
await NextCors(req, res, {
methods: ["GET", "HEAD", "PUT", "PATCH", "POST", "DELETE"],
origin: websiteDomain,
credentials: true,
allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()]
})
await superTokensNextWrapper(
async (next) => {
// This is needed for production deployments with Vercel
res.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate")
await middleware()(req, res, next)
},
req,
res
)
if (!res.writableEnded) {
res.status(404).send("Not found")
}
}
rp_st
02/26/2023, 5:49 AMNextCors
and also the res.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate")
line and try again?davido_k
02/26/2023, 5:57 AMdavido_k
02/26/2023, 5:57 AMrp_st
02/26/2023, 6:09 AMrp_st
02/26/2023, 7:03 AMdavido_k
02/26/2023, 2:44 PMrp_st
02/27/2023, 5:39 PMdavido_k
03/05/2023, 4:33 AM2023-03-05T04:30:32.767Z com.supertokens {t: "2023-03-05T04:30:32.767Z", message: "middleware: Request being handled by recipe. ID is: /signinup", file: "/Users/dave/Code/node_modules/supertokens-node/lib/build/supertokens.js:280:30" sdkVer: "13.1.2"}
2023-03-05T04:30:33.633Z com.supertokens {t: "2023-03-05T04:30:33.633Z", message: "errorHandler: Started", file: "/Users/dave/Code/node_modules/supertokens-node/lib/build/supertokens.js:323:26" sdkVer: "13.1.2"}
error - Error: SuperTokens core threw an error for a POST request to path: '/recipe/signinup' with status code: 400 and message: Field name 'id' is invalid in JSON input
at Querier.<anonymous> (/Users/dave/Code/node_modules/supertokens-node/lib/build/querier.js:259:31)
at Generator.throw (<anonymous>)
at rejected (/Users/dave/Code/node_modules/supertokens-node/lib/build/querier.js:22:44)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
page: '/api/auth/[[...path]]'
}
I have a console.write right after this that isn't getting hit
let response = await originalImplementation.thirdPartySignInUpPOST(input)
console.log("POST - Original complete")
rp_st
03/05/2023, 4:47 AMdavido_k
03/05/2023, 5:07 AMrp_st
03/05/2023, 5:07 AMdavido_k
03/05/2023, 5:13 AMrp_st
03/05/2023, 5:13 AMrp_st
03/05/2023, 5:14 AMdavido_k
03/05/2023, 5:26 AMdavido_k
03/05/2023, 5:38 AMrp_st
03/05/2023, 5:57 AMdavido_k
03/05/2023, 5:57 AMrp_st
03/05/2023, 5:58 AMdavido_k
03/05/2023, 5:58 AMdavido_k
03/05/2023, 6:03 AMrp_st
03/05/2023, 1:56 PMsattvikc
03/06/2023, 4:11 AMdavido_k
03/06/2023, 5:40 AM{"code":"c942ed63083c644fba342b6e6e520ab61.0.mwrq.QS54Cccps4yvKDM6ZOASoQ","thirdPartyId":"apple","redirectURI":"https://0ad1-135-134-205-237.ngrok.io/auth/callback/apple"}
sattvikc
03/06/2023, 5:57 AMsattvikc
03/06/2023, 6:08 AMts
function Apple(config: any) : ThirdParty.TypeProvider {
const appleProvider = ThirdParty.Apple(config);
return {
...appleProvider,
get: function(redirectURI: string | undefined, authCodeResponse: string | undefined, userContext: any) : TypeProviderGetResponse {
console.log("GET: ", redirectURI, authCodeResponse, userContext);
const getResponse = appleProvider.get(redirectURI, authCodeResponse, userContext);
return {
...getResponse,
getProfileInfo: async function(authCodeResponse, userContext) {
console.log("GET PROFILE INFO: ", authCodeResponse);
const result = await getResponse.getProfileInfo(authCodeResponse, userContext);
console.log('PROFILE RESULT', result);
return result;
}
}
}
}
}
can you try this apple provider and help me with the console logs? on the backenddavido_k
03/06/2023, 2:58 PMsattvikc
03/08/2023, 5:33 AM