Skip to content

Commit

Permalink
fix: grant: respect dynamic options (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop authored Apr 12, 2024
1 parent 5bf4a95 commit 7b6c5fb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/routes/oauth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,15 @@ export const oauthProviders = Router()
* @see {@link file://./config/index.ts}
*/
.use((req, res, next) => {
res.locals.grant = {
dynamic: {
origin: `${req.protocol}://${req.hostname}`,
},
};
if (!res.locals.grant) {
res.locals.grant = {};
}

if (!res.locals.grant.dynamic) {
res.locals.grant.dynamic = {};
}
res.locals.grant.dynamic['origin'] = `${req.protocol}://${req.hostname}`;

next();
})
.use(grant.express(grantConfig))
Expand Down

0 comments on commit 7b6c5fb

Please sign in to comment.