Skip to content

Commit

Permalink
fix: dynamic redirectUri neurosity
Browse files Browse the repository at this point in the history
  • Loading branch information
oreHGA committed Apr 7, 2024
1 parent 44ac29c commit 17822fb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/controllers/neurosity.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ const neurosity = new Neurosity({
});

exports.generateOAuthURL = async (req, res) => {
await neurosity
const redirectUri =
process.env.NEUROSITY_OAUTH_CLIENT_REDIRECT_URI ??
`https://${req.hostname}/neurosity-callback`;

await neurosity
.createOAuthURL({
clientId: process.env.NEUROSITY_OAUTH_CLIENT_ID,
clientSecret: process.env.NEUROSITY_OAUTH_CLIENT_SECRET,
redirectUri: process.env.NEUROSITY_OAUTH_CLIENT_REDIRECT_URI,
redirectUri: redirectUri,
responseType: "token",
state: Math.random().toString().split(".")[1], // A random string is required for security reasons
scope: [
Expand Down

0 comments on commit 17822fb

Please sign in to comment.