Merge pull request #51 from dadosfera/beta

Beta
This commit is contained in:
Rodrigo Zamboni
2022-04-14 15:33:36 -03:00
committed by GitHub
2 changed files with 4 additions and 3 deletions
-1
View File
@@ -14,7 +14,6 @@ import { HttpExceptionFilter } from 'src/error/http-exception.filter';
@UseFilters(new HttpExceptionFilter())
export class LoggerMiddleware implements NestMiddleware {
use = async (request: Request, response: Response, next: NextFunction) => {
console.log('Middle', new Date());
const idToken = request.get('Dadosfera-User');
const accessToken = request.get('Authorization');
const privateKey = process.env.JWT_PRIVATE_KEY;
+4 -2
View File
@@ -1,4 +1,4 @@
import { Body, Controller, Post } from '@nestjs/common';
import { Body, Controller, Post, UnauthorizedException } from '@nestjs/common';
import { AuthClientService } from 'src/clients/auth/client.service';
@@ -18,7 +18,9 @@ export class AuthController {
const tokens = await this.authClient
.signIn({ username, password })
.then((result) => result)
.catch((err) => console.log(err));
.catch((err) => {
throw new UnauthorizedException(err.message);
});
return tokens;
}