auth
auth copied to clipboard
Getting through the basics of setting up an authentication in Golang.
when i send a post request to create users i am getting this msg at the server end curl -d POST http://10.10.20.51:8000/register{"username":"john","email":"johndoe","Gender":"m","Password":"mysecurepassword",} 404 page not found 404 page not found...
In user.go function UpdateUser saves not hashed password to DB. So, it should look something like this: ``` func UpdateUser(w http.ResponseWriter, r *http.Request) { user := &models.User{} params := mux.Vars(r)...
user.go -> FindOne actually not working properly. It drops the error: > crypto/bcrypt: hashedSecret too short to be a bcrypted password in function `errf := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(password))` It's because of...
I Implemented the Jwt-Middleware (JwtVerify(...)) the same way as you did: ``` func JwtVerify(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var tk = r.Header.Get("x-access-token") // Grab the...