问题
While hitting an API from Postman I am getting this error.
API details:
URL:
https://account-perf.myglobal.com/v1/users/00uk0khprrME7gZOU0h7/credentials/change_password
Header:
Content-Type:application/json
Authorization:Bearer n7mbkw74jsubd7rauhptdnre
Type:
POST
Body:
{"password":"Baddy125@","token":"eyJhbGci...."}
Edit 1:
Web-service call to generate token-
URL-
https://api-perf.myglobal.com/rest/oauth2/v1/token
Type-
POST
Body-
client_id:abcd
client_secret:xyz
grant_type:client_credentials
回答1:
I had this whenever any unhandled endpoint method or resource was called. My setup is an API Gateway with defined resources (e.g. /myendpoint
) and defined methods for those endpoints (e.g. GET
).
To fix it, I created a Node.js Lambda function that just returned a 404. Then I added any ANY
method at the root of the endpoints /
and pointed it as a Lambda proxy function to the ANY methods.
Then I added a proxy resource, e.g. /{proxy}
-- there's a checkbox you can click when creating a resource to tell it to proxy. An ANY
method on that resource pointing to the same Lambda function, deploy the API, and I'm done.
Now instead of the auth bearer token error, I get a proper HTTP 404
error.
回答2:
Analyze and validate the request path, in case the request is incorrect this error is thrown at API Gateway. I stepped on the same error, when corrected the request parameters it worked well.
Let me know.
来源:https://stackoverflow.com/questions/55428711/not-a-valid-key-value-pair-missing-equal-sign-in-authorization-header