ga-wdi-boston / full-stack-project

Other
8 stars 64 forks source link

can't get change password curl request to work #980

Closed jingrid closed 7 years ago

jingrid commented 7 years ago

Hello!

Having issues get change-password.sh to run, keep getting 400 Bad Request.

My curl code:

API="${API_ORIGIN:-http://localhost:4741}"
URL_PATH="/change-password"
curl "${API}${URL_PATH}/${ID}" \
  --include \
  --request PATCH \
  --header "Authorization: Token token=${TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{
    "passwords": {
      "old": "'"${OLDPW}"'",
      "new": "'"${NEWPW}"'"
    }
  }'

echo

What I type into terminal:

ID=1 TOKEN="BAhJIiVlMjUxMWVhZDk4NDdhMzg1NjI4YzQ4NmI3OTliZmE5ZAY6BkVG--b3b4ccdc858686b26dc998c201c2ed63d835dcc3" OLD="ingrid" NEW="jingrid" sh scripts/change-password.sh

The token I use is the token I get when I sign in.

sos

Jcornmanhomonoff commented 7 years ago

So it looks like you're trying to insert variable names that don't exist. ie: OLD and NEW. Look at what you're using for the names of your variables for old and new in your password object.

jingrid commented 7 years ago

Ah, that was it!

Thanks!