inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

176만명의 커뮤니티!! 함께 토론해봐요.

findOne() undefined 이유 아시는분

미해결

따라하며 배우는 NestJS

async validate(payload) { const { username } = payload; console.log(username); console.log(payload); const user: User = await this.userRepository.findOne(username); if (!user) { throw new UnauthorizedException('error'); } return user; } } log leejinleejinseong { username: 'leejinleejinseong', iat: 1674638178, exp: 1674641778 } 위 로그처럼 데이터는 로그에 찍히는데 왜 findOne에서 undefined 나올까요? 이유 아시는분..2시간 박치기하고있습니다..덜덜;;; 별짓 다해봐도 해결이 안되네요;;

  • postgresql
  • NestJS
  • nestjs
  • typeorm
  • TypeORM
  • jwt
jslee 댓글 0 좋아요 0 조회수 488

logout 기능 오류

미해결

스프링부트 시큐리티 & JWT 강의

강사님이 작성한 코드대로 진행을 하여 로그인 기능과 jwt발급, 검증 하는 부분까지 전부 정상작동 하는것 까지 확인했습니다. 다만 postman 으로 Header에 jwt토큰 값을 넣고 post방식으로 /logout 메서드를 호출하였으나 404 에러가 뜨고 path는 logout이 아닌 login으로 응답이 내려옵니다. 디폴드 로그아웃 url이 /logout 으로 알고 있어서 별도의 로그아웃 기능을 구현하지 않는 상태인데 제가 잘못 알고 있는 것이 있을까요 ???

  • spring-security
  • spring
  • Spring Security
  • jwt
댓글 1 좋아요 0 조회수 685

[nodemon] app crashed - waiting for file changes before starting...

미해결

지금 당장 NodeJS 백엔드 개발 [사주 만세력]

PS C:\Users\jagit\SSYW\saju-backend-nodejs-master> npm install npm WARN config global --global , --local are deprecated. Use --location=global instead. up to date, audited 265 packages in 3s 26 packages are looking for funding run npm fund for details 8 vulnerabilities (6 moderate, 2 high) To address issues that do not require attention, run: npm audit fix To address all issues (including breaking changes), run: npm audit fix --force Run npm audit for details. PS C:\Users\jagit\SSYW\saju-backend-nodejs-master> npm run dev npm WARN config global --global , --local are deprecated. Use --location=global instead. > saju-backend-nodejs@1.0.0 dev > nodemon server [nodemon] 2.0.16 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: js,mjs,json [nodemon] starting node server.js C:\Users\jagit\SSYW\saju-backend-nodejs-master\node_modules\@slack\webhook\dist\IncomingWebhook.js:15 throw new Error('Incoming webhook URL is required'); ^ Error: Incoming webhook URL is required at new IncomingWebhook (C:\Users\jagit\SSYW\saju-backend-nodejs-master\node_modules\@slack\webhook\dist\IncomingWebhook.js:15:19) at Object.<anonymous> (C:\Users\jagit\SSYW\saju-backend-nodejs-master\app\commons\slack.js:2:17) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (C:\Users\jagit\SSYW\saju-backend-nodejs-master\server.js:7:15) at Module._compile (node:internal/modules/cjs/loader:1105:14) [nodemon] app crashed - waiting for file changes before starting... 여기서 부터 진행이 않됩니다. 도와주세요^^

  • node.js
  • nodejs
  • jwt
병정화李酉申 댓글 1 좋아요 0 조회수 879

Error response from daemon: Ports are not available

미해결

지금 당장 NodeJS 백엔드 개발 [사주 만세력]

PS B:\SSYW\saju-backend-nodejs-master> docker-compose up -d [+] Running 12/12 [+] Running 1/2 - Network saju-backend-nodejs-master_default Created 9.3s - Container saju_nodejs_mysql Starting 42.3s Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:3309 -> 0.0.0.0:0: listen tcp 0.0.0.0:3309: bind: An attempt was made to access a socket in a way forbidden by its access permissions. PS B:\SSYW\saju-backend-nodejs-master> 죄송한데요. 포트를 사용할 수가 없습니다. 해결 방법좀 가르쳐 주세요. ~~

  • node.js
  • nodejs
  • jwt
병정화李酉申 댓글 1 좋아요 0 조회수 1428

docker-compose up -d no configuration file provided: not found

미해결

지금 당장 NodeJS 백엔드 개발 [사주 만세력]

PS B:\SSYW\saju-backend-nodejs-master> docker-compose up -d no configuration file provided: not found 이렇게 나옵니다. 어떻게 하면 해결할 수 있나요? 도커는 설치되어 있습니다. 처음엔 되었는데(import?) , sql 워크브렌치 하다가 이상하게 되었습니다. 해결 부탁합니다.

  • node.js
  • nodejs
  • jwt
병정화李酉申 댓글 1 좋아요 -1 조회수 11355

회원가입 기능 구현

미해결

따라하며 배우는 NestJS

#7-2 회원가입 기능구현에서 강의 내용 전체 작성 후 회원가입 진행하였는데, username과 password가 컨트롤러에서 console.log(authCredentialDto)를 찍으니 빈 객체만 내뱉고 있고 db에 정상적으로 저장이 되지 않았습니다. 이리저리 코드를 수정해보니. dto 구성 단게에서 validator import 후에 정상적으로 출력이 됩니다. 강의 영상에서는 문제 없이 되던데 왜 이렇게 되는지 궁금합니다.

  • postgresql
  • jwt
  • nestjs
  • TypeORM
  • typeorm
  • NestJS
이정훈 댓글 0 좋아요 0 조회수 828

구현 완료 후 TypeError: this.userRepository.createUser is not a function

미해결

따라하며 배우는 NestJS

TypeError: this.userRepository.createUser is not a function 포스트맨에서 localhost:3000/auth/signup 실행시 서버가 터지며ㅑㄴ서 TypeError: this.userRepository.createUser is not a function 이런 에러를 내보내고 있는데, 아무리봐도 코드는 모두 똑같아서 무슨 문제인지 찾아지지가 않네요ㅠ

  • TypeORM
  • NestJS
  • jwt
  • postgresql
김형 댓글 1 좋아요 0 조회수 1596

intelliJ jdk11 oauth로그인 에러 문제입니다.

미해결

스프링부트 시큐리티 & JWT 강의

안녕하세요 훌륭한 강의를 잘 듣고있는 학생입니다. 다름이 아니라 제가 oauth로그인을 하면 오류가 발생하여 문의드립니다. 우선 저는 jdk11과 Gradle을 사용하고있습니다. 위와 같이 잘 작동하다가 아래와 같이 oauth로그인을 사용하면 에러가 발생합니다. Parameter 0 of method setFilterChains in org.springframework.security .config.annotation.web.configuration.WebSecurityConfiguration required a bean of type ' org.springframework.security .oauth2.client.registration.ClientRegistrationRepository' that could not be found. 에러의 총 내용은 위와 같습니다. 그래서 다른 질문들의 답변을 보니 라이브러리의 충돌 및 다운로드의 문제인거 같아 intelliJ에서 제공하는 invalidate cache기능을 사용하여 다시 재빌드를 하였지만 같은 에러가 발생하고 .\gradlew --refresh-dependencies를 사용하여 재빌드 또한 진행하였지만 같은 결과가 나왔습니다. 마지막으로 toolbox 및 인텔리제이를 다시 실행해도 같은 현상이 발생합니다. 혹시 방법을 알 수 있을까요??

  • jwt
  • spring
  • Spring Security
lcm2822 댓글 2 좋아요 1 조회수 3858

강의 잘들었습니다! 배포 자료 받을수있을까요?

미해결

따라하며 배우는 NestJS

안녕하세요. 강의 잘들었습니다. 감사합니다. 그런데 마지막에보여주신 배포관련 pdf 볼수있을까요? 다른분이 질문해주신 답글 https://drive.google.com/file/d/1z3QUaECsZ_bVHIUF-rYyDrNv_oCvR8re/view?usp=sharing 여기에는 한장의 사진만 보여서요!

  • TypeORM
  • jwt
  • NestJS
  • postgresql
댓글 1 좋아요 0 조회수 532

일반 스프링에서 진행

해결됨

Spring Boot JWT Tutorial

제가 사정이 있어서(학교 프로젝트) 스프링으로 진행을 해야 할 것 같은데, 스프링(메이븐,마이바티스)으로도 진행이 가능한가요? 맨처음부터 포스트맨으로 진행시 바로 hello가 떠버려서 멘붕입니다 ㅜㅜ

  • spring-boot
  • jwt
police0022 댓글 1 좋아요 0 조회수 588

JWT Token 구현에서 Session 을 사용한다?

미해결

스프링부트 시큐리티 & JWT 강의

안녕하세요 강사님. 이번 수업 너무 잘 들은 학생입니다. 다름이 아니라 JWT Token 을 필터단에서 Security에게 인가처리를 맡기기 위해 Security Context 에 Authentication을 저장한다고 하셨습니다. 이는 스프링 내 세션에 인증 객체를 저장해 두는 것으로 이해를 하였습니다. 1.수업중에도 설명해주셨듯이, 토큰을 사용하는 것은 세션에 인증 객체를 저장하지 않도록 해서 서버적으로 부하가 걸리는 상황을 방지하는 점이 큰 장점으로 이해하였으나, 결국 시큐리티에 인가를 맡기려면 세션에 저장하는 방법 밖에 없는지 궁금합니다. 필터들 사이에서 Authentication 정보를 주고 받아야 하니 스프링 시큐리티를 사용하려면 세션 저장 말고는 방법이 없는걸까요? 2.계속 생각하다보니 또 궁금해진 사항인데, [SecurityContextHolder 에 세션 정보를 저장해두는 것이 SpringSecurity 가 일반적으로 채택하고 있는 formLogin 방식에서 사용하는 세션 저장 방식]인 것으로 이해를 했습니다. 이 때, 왜 이 부분이 계속 세션을 저장해서 서버적으로 부하가 걸리게 하는 건지 잘 이해를 못한 것 같습니다. Authentication 과정을 살펴보면 그 때 인증을 하기 위해 형성한 Authentication 객체는 그 요청을 처리하기 위해 Thread Local 에 있는 SecurityContextHodler 에 저장을 해두고 인가를 처리하게 됩니다. 하지만 그 과정을 끝내고 나면 Holder를 비워주고, THread도 종료되기 때문에 서버 자체에는 딱히 저장되는 것은 없지 않나요? 보안적인 측면 외의 SESSION 방식의 단점을 잘 이해하지 못한 것 같습니다. 간략하게 라도 도움주시면 감사할 것 같습니다. 2번을 먼저 이해해보는게 1번을 이해하는데 도움이 될 것 같긴 하네요. 강의도 너무 잘들었습니다. 미리 감사드립니다.

  • spring
  • Spring Security
  • jwt
강우석 댓글 1 좋아요 2 조회수 3025

npm run start시 QueryFailedError: "username" 열의 자료 가운데 null 값이 있습니다. 에러가 발생합니다.

미해결

따라하며 배우는 NestJS

npm run start 로 application을 실행시켰을 때 QueryFailedError: "username" 열(해당 릴레이션 "user")의 자료 가운데 null 값이 있습니다 에러가 발생합니다. DB 상태는 회원가입한 유저가 user 테이블에 존재합니다.

  • queryfailederror
  • 에러
  • postgresql
  • jwt
  • nest.js
  • NestJS
  • TypeORM
김기쁨 댓글 1 좋아요 0 조회수 754

TokenProvider의 의존성 주입이 끝난 이후 key변수를 할당하는 이유

미해결

Spring Boot JWT Tutorial

3강 1:58에서 TokenProvider에 대해 설명해주시면서 빈 생성 이후 의존성 주입까지 받은 뒤 Key를 생성하기 위해 InitializingBean을 implement한다고 설명해주셨는데, 서치를 하다 보니 강사님처럼 인터페이스 구현 없이 생성자에서 바로 Key를 생성하는 코드도 간혹 보았습니다. 이처럼 생성자 호출 시에 Key를 만들지 않고 그 이후에 Key를 생성하신 구체적인 이유가 궁금합니다.

  • spring-boot
  • jwt
이보미 댓글 1 좋아요 0 조회수 733

비대칭키 jwt 인증 문제

미해결

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

http://localhost:8888/ecommerce/default 에서는 { name : "ecommerce", profiles : [ "default" ], label : null, version : "f45bf692a6cb54252ea12041f0aa92a71964a5f7", state : null, propertySources : [ { name : "file:///C:\\Users\\ydj90\\Downloads\\git/file:C:\Users\ydj90\Downloads\git\ecommerce.yml", source : { token.expiration_time : 864000000, gateway.ip : "172.30.1.33", token.secret : "userToken_token" } } ] } http://localhost:8888/user-service/default 에서는 { name : "user-service", profiles : [ "default" ], label : null, version : "f45bf692a6cb54252ea12041f0aa92a71964a5f7", state : null, propertySources : [ { name : "file:///C:\\Users\\ydj90\\Downloads\\git/file:C:\Users\ydj90\Downloads\git\user-service.yml", source : { spring.datasource.url : "jdbc:h2:mem:testdb", spring.datasource.driver-class-name : "org.h2.Driver", spring.datasource.generate-unique-name : false, token.expiration_time : 864000000, gateway.ip : "172.30.1.33", order_service.url : " http://ORDER-SERVICE/order-service/%s/orders ", spring.datasource.username : "sa", token.secret : "userToken_token" } } ] } 이와 같이 token.secret이 같은데 왜 subject가 null값이 되는지 이유를 알 수 가 없습니다. login하고 나온 header값을 가지고 bearer에 넣어 인증하는 방식이 아닙니까? 이유를 잘 모르겠습니다. JWT token is not valid 이게 왜 뜨는지 subject = Jwts.parser().setSigningKey(env.getProperty("token.secret")) .parseClaimsJws(jwt).getBody() .getSubject(); 여기서 왜 null값으로 값을 반환하는지 이해를 할 수가 없습니다.

  • 비대칭키
  • jwt
  • spring-cloud
  • spring-boot
  • JPA
  • architecture
  • msa
  • Kafka
JUNI 댓글 4 좋아요 0 조회수 700

typeorm 0.3.x 버전 오류

미해결

따라하며 배우는 NestJS

많은 분들이 남겨준 것처럼 typeorm 0.3.x 버전 오류로 인해 저도 조금 고생했습니다. 공식문서 참조하며 해결했습니다. https://docs.nestjs.com/techniques/database#repository-pattern typeorm 0.3.x 버전은 @EntityRepository 가 deprecated 됐기 때문에 custom Repository를 생성해주었습니다. custom Repository 생성은 아래 블로그를 참조했습니다. https://velog.io/@pk3669/typeorm-0.3.x-EntityRepository-%EB%8F%8C%EB%A0%A4%EC%A4%98 위 링크 내용을 참조로 typeorm-ex.decorator.ts 파일과 typeorm-ex.module.ts 파일을 생성합니다. 해당 링크가 문제가 될 시 링크 바로 삭제하도록 하겠습니다 ㅠ.. typeorm.config.ts entities 를 불러오기 위해 경로 또는 저희가 설정한 entitiy 를 바로 집어 넣었습니다. autoLoadEntities: true - entities를 빼고 해당 옵션을 넣어서 자동으로 불러올 수도 있습니다. (본인이 직접 컨트롤 하는 것이 아니기 때문에 부정확해질 수도 있음.) board.repository.ts 저희 repository에 @EntityRepository 대신 CustomRepository(Board) 을 넣어줍니다. board.module.ts imports는 custom Repository를 불러와야 하기 때문에, 저희가 만든 TypeOrmExModule class의 forCustomRepository에 저희 Repository를 넣어줍니다. board.service.ts 기존에 @EntityRepository 를 사용한 경우 @InjectRepository 데코레이터를 사용했지만 해당 부분을 유지하면 오류가 발생한다고 합니다. 따라서 @CustomRepository 를 생성하여 사용하는 경우 @InjectRepository 를 제거하고 사용합니다. 이러면 아직 findOne 메소드의 id는 빨간줄인데 findOne 메소드는 options 로 FindOneOptions Parameter를 받게 되어 있고 해당 FindOneOptions 중 저희가 사용할 것은 where 옵션을 사용해야 해당 id 를 통해 데이터를 불러올 수 있습니다. 그래서 최종적으로 findOne 메소드는 아래 그림과 바꿔주면 해당 메소드를 사용할 수 있게 됩니다.

  • postgresql
  • jwt
  • NestJS
  • TypeORM
현석 댓글 3 좋아요 12 조회수 2391

토큰 인증 시스템 관련

미해결

[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!

안녕하세요? 초보부터 중급까지 아주 재미있게 진행해 나가고 있습니다. 강의와 직접적인 연관은 아니지만, 간접적인 연관인 부분이 궁금해서 질문 드립니다. 클라이언트 기반의 로직은 대부분 강의에 나와 있어서 프로세스가 이해가 되는데요. 서버쪽은 대략은 짐작이 되나, 구체적으로 어떻게 돌아가는지 알고 싶은데, 어떤 자료를 어디서 참고해야 될지 조언을 구합니다. 예를 들면 인증 API 중에 /auth/login API를 사용하면 정해진 유저 ( test@codefactory.ai :testtest)에 대해 Base64로 인코딩된 값으로 서버로 던지면 서버에서 디코딩해서 원래의 값을 찾은 후 DB를 검색할 거 같은데, PPT에 설명해주신 자료에 보면 DB를 사용하지 않는다? 라고 하셔서 그럼 어떻게 인증을 하지? 라는 궁금증이 생겼습니다. 결론적으로 토큰기반 인증시스템에 대해 서버쪽 프로세스를 알고 싶은데, 관련 자료 알고 계신부분이 있다면 조언 부탁드립니다. 아울러 자바 (또는 스프링) 기반의 샘플 소스 코드도 있다면 더욱 좋고요.. 두서 없이 질문 드려서 죄송합니다.

  • 토큰
  • 하이브리드 앱
  • 인증
  • jwt
  • Flutter
archy712 댓글 1 좋아요 -1 조회수 465

authenticationManagerBuilder에서 getObject를 할때 에러가 뜹니다.

해결됨

Spring Boot JWT Tutorial

authenticationManagerBuilder.getObject(); This object has not been built at org.springframework.security .config.annotation.AbstractSecurityBuilder.getObject( AbstractSecurityBuilder.java:51 ) ~[spring-security-config-5.7.4.jar:5.7.4] 왜그러는걸까요 추가로 DaoAuthenticationProvider에서 자동으로 additionalAuthenticationChecks해줘서 String presentedPassword = authentication.getCredentials().toString(); if (!this.passwordEncoder.matches(presentedPassword, userDetails.getPassword())) { this.logger.debug("Failed to authenticate since password does not match stored value"); throw new BadCredentialsException(this.messages .getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials")); } 패스워드를 체크할 수 있다는 글을 보았는데 확인해보니 deprecation이 되어있습니다. 사용하지 않는게 좋나요?

  • jwt
  • spring-boot
댓글 1 좋아요 0 조회수 529

저는 왜 import가 자동으로 되지 않을까요?

미해결

따라하며 배우는 NestJS

혹시 관련 모듈이나 단축키가 있을까아ㅛ? 이번 강의에서는 BaseEntity가 영상에서 보면 자동으로 import가 되던데 저는 되지 않습니다;

  • postgresql
  • NestJS
  • jwt
  • TypeORM
조경찬 댓글 2 좋아요 0 조회수 5186

회원가입 후 loginForm에서 로그인시 홈으로 이동 안될시 확인할 사항

미해결

스프링부트 시큐리티 & JWT 강의

// PrincipalDetail 클래스에서 모두 True로 하고 돌려보세요. // 그러면 잘됩니다. // password 리턴 @Override public String getPassword() { return user.getPassword(); } @Override public String getUsername() { return user.getUsername(); } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { // 1년동안 회원이 로그인을 안하면, 휴먼 계정으로 하기로함 // 현재시간 - 로그인 시간 >= 1년을 초과하면 return false 등등... return true; }

  • spring
  • Spring Security
  • jwt
댓글 3 좋아요 1 조회수 818

인기 태그

인프런 TOP Writers

주간 인기글