0

I'm using Advanced Access Manager (AAM) plugin, and have been trying to refresh a still valid JWT token using the /aam/v1/refresh-jwt RESTful endpoing, however I’m getting the following error:

“rest_jwt_validation_failure”: [“Wrong number of segments”]

The way I’m calling the endpoint is as follows:

POST {{Base URL}}/wp-json/aam/v1/authenticate
HEADERS Authentication: Bearer {{token}}

Any though on what am I doing wrong?

1

At first glance it looks like you need to POST the token as a 'jwt' property in a JSON object, the same way you'd POST it to the validate endpoint:

curl -X POST \
  http://dev.wordpress/wp-json/aam/v1/refresh-jwt \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
    "jwt": "0yJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDM4OTExNjQsImV4cCI6MTU0Mzk3NzU2NCwidXNlcklkIjoxfQ.0wGIbcTDH5yWSsdStZFct_-auyOFJqf3NKQasTCs4QU"
}'

(based on https://forum.aamplugin.com/d/4-how-to-validate-jwt-token)

It doesn't look like this code reads the token from the Authorization header (and it's 'Authorization' not 'Authentication').

  • Thanks! Yes, I wasn't really sending the token in the right way :P – nikano Jul 12 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.