강의

멘토링

커뮤니티

Inflearn Community Q&A

dev's profile image
dev

asked

Node and React series that you can learn by following - Basic lecture

Node React Basics Lecture #12 Token Generation with jsonwebtoken

로그인 구현시 자꾸 비밀번호가 틀렸다고 나옵니다..

Written on

·

1.3K

0

안녕하세요 선생님.

강의 잘 보고 있습니다. 감사합니다.

bcrypt.compare(plainpassword, this.password, function(err, isMatch){
        console.log(isMatch);
        // 비밀번호가 다르다면
        // callbackfunction에 err를 넣어 return
        if(err) return callbackfunction(err);

        // 비밀번호가 같다면
        // isMatch는 true값임, err는 없으므로 unll값을 넣는다
        callbackfunction(null, isMatch);
    }) 

이와 같은 코드에서 isMatch가 undefined로 출력됩니다.

비밀번호를 맞는 비밀번호로 입력하여도 undefined로 출력이 되는데, 어떤게 잘못 되었는지 알 수 있을까요?

저의 깃허브 주소는 https://github.com/onejaejae/SignUp입니다 !!

reactnodejs

Answer 2

1

Dev님의 프로필 이미지
Dev
Questioner

data and hash arguments required 오류가 뜨길래 봤더니

index.js 에서 req.body.password를 오타를 내서 undefinde 변수가 들어가서 생긴 오류였습니다,,

감사합니다!!

0

저도 오타나서 해결했습니다. 감사합니다.

dev's profile image
dev

asked

Ask a question