Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 Authorization Required #307

Open
1 task done
Kuro091 opened this issue Sep 13, 2024 · 2 comments
Open
1 task done

401 Authorization Required #307

Kuro091 opened this issue Sep 13, 2024 · 2 comments

Comments

@Kuro091
Copy link

Kuro091 commented Sep 13, 2024

Issue Name

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest plugin version
  • [x ] I am running the latest WordPress version
  • [ x] I know what PHP version I'm using
  • [ x] I checked the documentation and found no answer
  • [ x] I checked to make sure that this issue has not already been filed

Context

I ran through all the setups procedures. I can see wp-json/jwt-auth/v1/ being added and can see them through GET.

However when I try to POST to wp-json/jwt-auth/v1/token, with username and password being in form data it results in 401 Authorization Required.

Any ideas how to debug this/what caused this?

@urlund
Copy link

urlund commented Oct 22, 2024

@Kuro091 use JSON body:

{
  "username": "your_username",
  "password": "your_password"
}
curl --request POST \
  --url http://example.com/wp-json/jwt-auth/v1/token \
  --header 'Content-Type: application/json' \
  --data '{"username": "your_username", "password": "your_password"}'

@colombinis
Copy link

colombinis commented Nov 5, 2024

@Kuro091
I've just tried in my local project with postman and from comand line (exported from postman)
it worked in both.

curl --location 'http://local.example.com/wp-json/jwt-auth/v1/token' \
--header 'Content-Type: application/json' \
--data '{
    "username":"Sebastian",
    "password":"password"
}'

{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWwucGFzc3RoZWtleXMuY29tIiwiaWF0IjoxNzMwODIwNjY0LCJuYmYiOjE3MzA4MjA2NjQsImV4cCI6MTczMTQyNTQ2NCwiZGF0YSI6eyJ1c2VyIjp7ImlkIjoiNTcifX19.hYKmQrJXm0jB8cmgQbHZEfuGfOo5JtShdyrUwtPQhZk","user_email":"[email protected]","user_nicename":"sebastian","user_display_name":"Sebastian"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants