【发布时间】:2016-08-18 03:43:11
【问题描述】:
我正在使用 WP REST API 和 oAuth1.0 服务器插件进行身份验证。到目前为止,Postman 需要经过身份验证才能访问端点,但浏览器不需要身份验证。任何人都可以通过浏览器访问 API 响应。是否可以限制浏览器中的 API 访问?我不希望未经身份验证的人看到 API 的敏感数据。
附: oAuth1.0 服务器插件已激活,Postman 中的身份验证完美运行!
示例。当我在浏览器中输入 http://localhost:8080/api/v1/categories 时,我得到类别的 JSON 响应,当我在 Postman 中输入相同的端点时,我得到:
{
"code": "json_oauth1_missing_parameter",
"message": "Missing OAuth parameter oauth_token",
"data": {
"status": 401
}
}
【问题讨论】:
标签: php wordpress api rest oauth