Skip to content

Commit

Permalink
added secret key base
Browse files Browse the repository at this point in the history
  • Loading branch information
leightkt committed Mar 11, 2021
1 parent 567782d commit aadf0fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ app.post('/users', (request, response) => {
.then(user => queries.showUser(user.id))
.then(thisuser => {
const payload = { username: thisuser[0].username }
const secret = "bootsandbuffalosauce"
const secret = process.env.SECRET_KEY_BASE

jwt.sign(payload, secret, (error, token) => {
if (error) throw new Error("Signing Token didn't work")
Expand Down Expand Up @@ -93,7 +93,7 @@ app.post('/login', (request, response) => {
throw new Error("incorrect password")
} else {
const payload = { username: results[1].username}
const secret = "bootsandbuffalosauce"
const secret = process.env.SECRET_KEY_BASE

jwt.sign(payload, secret, (error, token) => {
if (error) throw new Error("Signing Token didn't work")
Expand Down Expand Up @@ -130,7 +130,7 @@ app.get('/profile', authenticate, (request, response) => {
})

function authenticate(request, response, next){
const secret = "bootsandbuffalosauce"
const secret = process.env.SECRET_KEY_BASE
const authHeader = request.get("Authorization")
if(!authHeader){
response.json({ errors: "no token"})
Expand Down

0 comments on commit aadf0fc

Please sign in to comment.