我正在尝试将 spring-security-oauth2.0
与基于 Java 的配置一起使用。我的配置已完成,但是当我在 tomcat 上部署应用程序并点击 /oauth/token
访问令牌的 url, Oauth
生成以下错误:
<oauth>
<error_description>Full authentication is required to access this resource</error_description>
<error>unauthorized</error>
</oauth>
我的配置在 Git hub 上,请点击链接
代码量大,参考git。我正在使用 chrome postman 客户端发送请求。以下是我的要求。
POST /dummy-project-web/oauth/token HTTP/1.1
Host: localhost:8081
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=abc%40gmail.com&client_secret=12345678
错误就像,URL 是安全的 Oauth
,但在配置中,我授予访问此 URL 的所有权限。这个问题到底是什么?
原文由 Harmeet Singh Taara 发布,翻译遵循 CC BY-SA 4.0 许可协议
client_id
和client_secret
,默认情况下,应该放在授权标头中,而不是 form-urlencoded 主体中。client_id
和client_secret
,它们之间有一个冒号:abc@gmail.com:12345678
。YWJjQGdtYWlsLmNvbToxMjM0NTY3OA==
Authorization: Basic YWJjQGdtYWlsLmNvbToxMjM0NTY3OA==