Skip to content

Commit

Permalink
Merge pull request fga-eps-mds#8 from fga-eps-mds/70_login-microsoft
Browse files Browse the repository at this point in the history
define redirect pattern
  • Loading branch information
DaviMatheus authored Jul 30, 2024
2 parents 8ab665e + f1fcbff commit c5dc001
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export class AuthController {
this.logger.log('AuthController - Google Callback Request:', req.user);

const user = req.user as any;
const { access_token } = user || {};
const { accessToken } = user || {};

if (access_token) {
res.redirect(`http://localhost:3000?token=${access_token}`);
if (accessToken) {
res.redirect(`${this.configService.get<string>('FRONTEND_URL')}/oauth?token=${accessToken}`);
} else {
res.redirect('http://localhost:3000/login');
res.redirect(`${this.configService.get<string>('FRONTEND_URL')}/cadastro`);
}
}

Expand All @@ -82,11 +82,11 @@ export class AuthController {
);

const user = req.user as any;
const { access_token } = user || {};
const { accessToken } = user || {};

if (access_token) {
if (accessToken) {
res.redirect(
`${this.configService.get<string>('FRONTEND_URL')}/oauth?token=${access_token}`,
`${this.configService.get<string>('FRONTEND_URL')}/oauth?token=${accessToken}`,
);
} else {
res.redirect(
Expand Down

0 comments on commit c5dc001

Please sign in to comment.