fix(login): add CORS permissions to main.ts, modify login route to include versioning
This commit is contained in:
parent
44b064b87f
commit
28b2a7ccd8
|
|
@ -1775,7 +1775,7 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/auth/login": {
|
"/auth/v1/login": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "AuthController_login",
|
"operationId": "AuthController_login",
|
||||||
"parameters": [],
|
"parameters": [],
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,18 @@ async function bootstrap() {
|
||||||
rolling: true,
|
rolling: true,
|
||||||
cookie: {
|
cookie: {
|
||||||
maxAge: 30 * 60 * 1000,
|
maxAge: 30 * 60 * 1000,
|
||||||
httpOnly: false,
|
httpOnly: true,
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
app.use(passport.session());
|
app.use(passport.session());
|
||||||
|
|
||||||
|
// Enable CORS
|
||||||
|
app.enableCors({
|
||||||
|
origin: 'http://localhost:9000',
|
||||||
|
credentials: true,
|
||||||
|
});
|
||||||
|
|
||||||
//swagger config
|
//swagger config
|
||||||
const config = new DocumentBuilder()
|
const config = new DocumentBuilder()
|
||||||
.setTitle('Targo_Backend')
|
.setTitle('Targo_Backend')
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ import { Request, Response } from 'express';
|
||||||
export class AuthController {
|
export class AuthController {
|
||||||
|
|
||||||
@UseGuards(OIDCLoginGuard)
|
@UseGuards(OIDCLoginGuard)
|
||||||
@Get('/login')
|
@Get('/v1/login')
|
||||||
login() {}
|
login() {}
|
||||||
|
|
||||||
@Get('/callback')
|
@Get('/callback')
|
||||||
@UseGuards(OIDCLoginGuard)
|
@UseGuards(OIDCLoginGuard)
|
||||||
loginCallback(@Req() req: Request, @Res() res: Response) {
|
loginCallback(@Req() req: Request, @Res() res: Response) {
|
||||||
res.redirect('/');
|
res.redirect('http://localhost:9000/#/login-success');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user