Oauth2 Spring安全授权码

克劳斯

我正在尝试复制此处提供的oauth服务器:

https://spring.io/blog/2015/02/03/sso-with-oauth2-angular-js-and-spring-security-part-v测试此基本服务器的curl调用应为:

curl acme:acmesecret@localhost:9999/uaa/oauth/token  \
-d grant_type=authorization_code -d client_id=acme     \
-d redirect_uri=http://example.com -d code=jYWioI

虽然我不断收到以下错误:无效的授权代码:jYWioI

授权服务器中的授权代码在哪里配置?

拉斐尔·泽法(Rafael Zeffa)

您需要生成一个新的授权码!

您可以使用授权类型authorization_code或密码来完成此操作

使用authorization_code:

打开浏览器并访问授权端点http:// localhost:9999 / uaa / oauth / authorize?response_type = code&client_id = acme&redirect_uri = http://example.com

登录过程(登录:用户密码:password)之后,您将被重定向到http://example.com/?code=CODE <-这是您在下一个请求中应使用的代码

现在您获得令牌:

curl acme:acmesecret@localhost:9999/uaa/oauth/token -d grant_type=authorization_code -d client_id=acme -d redirect_uri=http://example.com -d code=CODE

响应:{“ access_token”:“ eyJhbGciOiJS .....”}

使用密码grantType:

curl acme:acmesecret@localhost:9999/uaa/oauth/token  -d grant_type=password -d username=user -d password=password

响应:{“ access_token”:“ eyJhbGciOiJS .....”}

我建议您阅读有关oauth grantTypes的更多信息,以了解什么对您的解决方案更好:https: //aaronparecki.com/articles/2012/07/29/1/oauth2-simplified

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Linkedin OAuth2授权码错误

来自分类Dev

Spring 安全 Oauth2 令牌错误:“缺少授权类型”

来自分类Dev

Spring Security OAuth2授权过程

来自分类Dev

OAuth2的目的是使用授权码刷新令牌

来自分类Dev

正确的授权码OAuth2流是什么?

来自分类Dev

Oauth2令牌交换授权码:400错误

来自分类Dev

Spring oauth2 InsufficientAuthenticationException

来自分类Dev

交换访问令牌的授权码时,为什么收到无效的令牌响应?(Spring Boot,oauth2,azure)

来自分类Dev

使用XML作为授权码的示例Spring Security OAuth2客户端配置在哪里?

来自分类Dev

Spring OAuth2解释授权服务器配置

来自分类Dev

Spring Boot OAuth2基于角色的授权实现

来自分类Dev

Oauth2用于授权和认证?

来自分类Dev

OAuth2服务到服务授权

来自分类Dev

小工具OAuth2授权

来自分类Dev

OAuth2服务到服务授权

来自分类Dev

原生应用 OAuth2 授权

来自分类Dev

OAuth2 (Okta):如何设置授权

来自分类Dev

春季安全OAuth2 | InsufficientAuthenticationException

来自分类Dev

如何更安全的 OAuth2 请求?

来自分类Dev

用于集中社交登录的 2 跳“授权码”流程 oauth2 身份验证

来自分类Dev

Spring Security OAuth2 UserRedirectRequiredException

来自分类Dev

Spring Security OAuth2简单配置

来自分类Dev

在Oauth2 Spring中更改响应

来自分类Dev

Spring Oauth2隐式流

来自分类Dev

Oauth2 Spring Security Authorization Code

来自分类Dev

Spring Security OAuth2接受JSON

来自分类Dev

在Oauth2 Spring中更改响应

来自分类Dev

了解Spring Boot的Oauth2入门

来自分类Dev

使用 Spring OAuth2 的 Springboot