From 1debb9f04b938de7f3d498a3fbe9f65af465e591 Mon Sep 17 00:00:00 2001 From: bluehorn07 Date: Mon, 13 Nov 2023 21:07:22 +0900 Subject: [PATCH] authentication success! --- src/auth/auth.controller.ts | 3 --- src/auth/passport/jwt.strategy.ts | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 610e493..7c00210 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -4,8 +4,6 @@ import { Get, Post, UseGuards, - UsePipes, - ValidationPipe, } from '@nestjs/common'; import { AuthService } from './auth.service'; @@ -22,7 +20,6 @@ export class AuthController { } @Post('/login') - @UsePipes(ValidationPipe) async login(@Body() authLoginUserDto: AuthLoginUserDto) { return await this.awsCognitoService.authenticateUser(authLoginUserDto); } diff --git a/src/auth/passport/jwt.strategy.ts b/src/auth/passport/jwt.strategy.ts index 5768e41..5d9df0a 100644 --- a/src/auth/passport/jwt.strategy.ts +++ b/src/auth/passport/jwt.strategy.ts @@ -9,14 +9,14 @@ export class JwtStrategy extends PassportStrategy(Strategy) { super({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), ignoreExpiration: false, - _audience: process.env.AWS_COGNITO_COGNITO_CLIENT_ID, - issuer: process.env.AWS_COGNITO_AUTHORITY, + _audience: process.env.AWS_COGNITO_CLIENT_ID, + issuer: `https://cognito-idp.ap-northeast-2.amazonaws.com/${process.env.AWS_COGNITO_USER_POOL_ID}`, algorithms: ['RS256'], secretOrKeyProvider: passportJwtSecret({ cache: true, rateLimit: true, jwksRequestsPerMinute: 5, - jwksUri: process.env.AWS_COGNITO_AUTHORITY + '/.well-known/jwks.json', + jwksUri: `https://cognito-idp.ap-northeast-2.amazonaws.com/${process.env.AWS_COGNITO_USER_POOL_ID}/.well-known/jwks.json`, }), }); }