简体   繁体   中英

Strange error while requesting user token

I am able to login to the API and get back a bearer token, however if I then try to request an api token for the admin user, I get:

{
    "message": "Not Found",
    "internalMessage": "The rest endpoint or resource for given path {/api/v2/users/715ece57728243a993dce051949d2e90/token} could not be found. Please verify that your Accept header is set correctly. I got {application/json}. It must accept {application/json}"
}

The uuid was copy/pasted from /mesh-ui/#/admin/users/715ece57728243a993dce051949d2e90

I have both Accept and Content-Type headers set to application/json in the request. The API request is going to localhost with stock install ( mesh-compose ) using the gentics/mesh:1.7.1 image. All I've done in the UI is login as the admin to set the first password.

Any ideas what I'm doing wrong here?

Cheers, and thank you for your time!

edit

I noticed MeshRestClient is sending requests to /api/v1 . Is this expected? Am I using the wrong endpoint perhaps? For clarity, my ultimate goal is to request an API token I can give to MeshRestClient so it can login without user/pass combo.

Currently the only api changes for v2 are within the GraphQL endpoint. So loading the token should work for API v1 / v2.

Loading a new token must be done via a POST request.

See https://getmesh.io/docs/api/#users__userUuid__token_post

I suspect you are using the wrong HTTP method.

POST is used since this operation is modifying the user and to avoid accidentally generating a new toke when pasting the URL in the browser.

The previously issued token will be invalidated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM