WSO2-AM 3.2.0 - 确保你的 API 调用有一个 header: testkey is missing
WSO2-AM 3.2.0 - Make sure your API invocation call has a header: testkey is missing
我已经在 WSO2 AM 中发布了一个 API,现在,当我尝试通过 curl 测试 API,传递令牌时,它显示错误:
卷曲请求:
curl -X GET "https://192.168.21.120:8243/ms-authorization/1.0.0/authorization/access-type/access-type"
-H "accept: application/json" -H "Authorization: Bearer eyJ4NXQiOiJNell4TW1Ga09HWXdNV0kwWldObU5Er0m9eU..
-iNxXl0D9to5ptemrd42itirPDJiYJJ_FkSMKSfQ6m78X2fr-Tag" -k
回复:
{"fault":{"code":900902,"message":"Missing Credentials","description":"Authentication Error. Make sure your API invocation call has a header: testkey is missing"}}
为什么在 header 中需要“测试密钥”?
如果您尝试使用发布者测试控制台测试 API,您需要将生成的访问 token/test 密钥与 header testkey
.
例如:
curl -X GET "https://localhost:8243/napi/1.0/*" -H "accept: */*" -H "testkey: 032456ff-4764-4321-2348-e7ad1ac5t6g0" -k
我刚刚启用了 CORS 配置,重新部署了 API,一切正常:
我已经在 WSO2 AM 中发布了一个 API,现在,当我尝试通过 curl 测试 API,传递令牌时,它显示错误:
卷曲请求:
curl -X GET "https://192.168.21.120:8243/ms-authorization/1.0.0/authorization/access-type/access-type"
-H "accept: application/json" -H "Authorization: Bearer eyJ4NXQiOiJNell4TW1Ga09HWXdNV0kwWldObU5Er0m9eU..
-iNxXl0D9to5ptemrd42itirPDJiYJJ_FkSMKSfQ6m78X2fr-Tag" -k
回复:
{"fault":{"code":900902,"message":"Missing Credentials","description":"Authentication Error. Make sure your API invocation call has a header: testkey is missing"}}
为什么在 header 中需要“测试密钥”?
如果您尝试使用发布者测试控制台测试 API,您需要将生成的访问 token/test 密钥与 header testkey
.
例如:
curl -X GET "https://localhost:8243/napi/1.0/*" -H "accept: */*" -H "testkey: 032456ff-4764-4321-2348-e7ad1ac5t6g0" -k
我刚刚启用了 CORS 配置,重新部署了 API,一切正常: