最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

rest api - Advanced Access Manager: RESTful endpoint to refresh token

programmeradmin1浏览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?

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?

Share Improve this question asked Jul 12, 2019 at 11:54 nikanonikano 1033 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 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/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').

发布评论

评论列表(0)

  1. 暂无评论