Skip to content

Commit

Permalink
teste prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Joabesv committed Sep 21, 2024
1 parent 7f96cf0 commit 67e0ffb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions apps/core/src/plugins/oauth2/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,26 @@ async function oauth2(app: FastifyInstance, opts: NextOauthOptions) {
auth: providers[provider].config,
},
scope: providers[provider].scope,
startRedirectPath,
callbackUri: (req) => {
return `${Config.PROTOCOL}://${req.hostname}${startRedirectPath}/callback`;
return `${Config.PROTOCOL}://${req.hostname}/login/${provider}/callback`;
},
});

app.get(`/login/google`, async function (request, reply) {
try {
const validatedURI = await this[provider].generateAuthorizationUri(
request,
reply,
);
request.log.warn(validatedURI, 'redirecting to');
return reply.redirect(validatedURI);
} catch (error) {
request.log.warn(error);
}
});

app.get(
`/login/${provider}/callback`,
`/login/google/callback`,
async function (
request: FastifyRequest<{ Querystring: Querystring }>,
reply,
Expand Down

0 comments on commit 67e0ffb

Please sign in to comment.