0

so I am working on the backend of my web app. I keep getting this error: password authentication failed for user "postgre"

const express = require("express")
const router = express.Router()
const Pool = require('pg').Pool
const pool = new Pool({
    user: 'postgre',
    host: 'localhost',
    database: 'p2p',
    password: 'hello',
    port: 5432,
  })

router.get('/',(req,res)=>{
    res.render('physician/login')
})

//table: doc_reg, 
router.post('/loggedin',(req,res)=>{
    const {user_name,pw_1}=req.body
    pool.query('INSERT INTO doc_reg (username,pw) VALUES ($1,$2)',[user_name,pw_1],(err, results)=>{
        if (err){
            console.log(err)
        }
        res.render('physician/loggedin',{username:user_name})
    })
})

module.exports=router

Anything went wrong here?

1
  • If you use another way to connect with db works? For example using psql or another postgresql db client? Commented May 8, 2020 at 19:38

1 Answer 1

1

Generally, this error occurs when you are using the wrong password for the given user.

Sign up to request clarification or add additional context in comments.

1 Comment

i swear that is the password i set up

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.