Oauth2 Spring Security Authorization Code

Klaus

I am trying to reproduce the oauth server provided here:

https://spring.io/blog/2015/02/03/sso-with-oauth2-angular-js-and-spring-security-part-v The curl call for testing this basic server should be:

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

Though I keep getting the following error: Invalid authorization code: jYWioI

Where is this authorization code to be configured in the authorization server?

Rafael Zeffa

You need to generate a new authorization code!

You can do it using the grant type authorization_code or password

Using the authorization_code:

Open your browser and to visit the authorization endpoint http://localhost:9999/uaa/oauth/authorize?response_type=code&client_id=acme&redirect_uri=http://example.com

After the login process (login: user password: password), you will be redirected to http://example.com/?code=CODE <-- this is the code that you should use in the next request

now you get the token:

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

response: {"access_token":"eyJhbGciOiJS....."}

Using the password grantType:

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

response: {"access_token":"eyJhbGciOiJS....."}

I recommend you to read more about oauth grantTypes, to know what's is better for your solution https://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified

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

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

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Spring Security OAuth2授权过程

来自分类Dev

Spring Security OAuth2 UserRedirectRequiredException

来自分类Dev

Spring Security OAuth2简单配置

来自分类Dev

Spring Security OAuth2接受JSON

来自分类Dev

OAuth2 Spring Security - OAuth2AuthenticationProcessingFilter not working

来自分类Dev

OAuth2 purpose of refresh token with authorization code

来自分类Dev

从Spring Boot Oauth2迁移到Spring Security 5

来自分类Dev

Spring Security OAuth2纯资源服务器

来自分类Dev

微服务和Spring Security OAuth2

来自分类Dev

Spring Security OAuth2跳舞并获取参数

来自分类Dev

Spring Security OAuth2:清除令牌存储

来自分类Dev

Oauth2 Request Token using Spring Security

来自分类Dev

Spring Security OAuth2和表单登录配置

来自分类Dev

使用Spring Security的Oauth2请求令牌

来自分类Dev

无法触发Spring Security OAuth2登录

来自分类Dev

Spring Security,OAUTH2,动态客户端秘密

来自分类Dev

使用Spring Security OAuth2的刷新令牌为null

来自分类Dev

在Spring Security OAuth2中自定义TokenEndpoint

来自分类Dev

用于春季网站的Spring Security Oauth2

来自分类Dev

Spring Security - 用于 oAuth2 实现的 UserDetailsService?

来自分类Dev

Spring security oauth2 修改响应体连接

来自分类Dev

Spring Security 使用什么来生成 OAuth2 令牌?

来自分类Dev

Javascript WebApp 的 Spring Security Oauth2 身份验证

来自分类Dev

注销在 Spring Security OAuth2 中无法正常工作

来自分类Dev

OAuth2 Spring Security-OAuth2AuthenticationProcessingFilter不起作用

来自分类Dev

OAuth2 Spring Security-OAuth2AuthenticationProcessingFilter不起作用

来自分类Dev

如何刷新的OAuth2令牌使用Spring Security 5 OAuth2用户端和RestTemplate

来自分类Dev

如何仅为 Spring Boot Security OAuth2 应用程序中的某些类启用 OAuth2?

来自分类Dev

如何使用XML使用Spring Security Oauth2启用/ oauth / check_token

Related 相关文章

  1. 1

    Spring Security OAuth2授权过程

  2. 2

    Spring Security OAuth2 UserRedirectRequiredException

  3. 3

    Spring Security OAuth2简单配置

  4. 4

    Spring Security OAuth2接受JSON

  5. 5

    OAuth2 Spring Security - OAuth2AuthenticationProcessingFilter not working

  6. 6

    OAuth2 purpose of refresh token with authorization code

  7. 7

    从Spring Boot Oauth2迁移到Spring Security 5

  8. 8

    Spring Security OAuth2纯资源服务器

  9. 9

    微服务和Spring Security OAuth2

  10. 10

    Spring Security OAuth2跳舞并获取参数

  11. 11

    Spring Security OAuth2:清除令牌存储

  12. 12

    Oauth2 Request Token using Spring Security

  13. 13

    Spring Security OAuth2和表单登录配置

  14. 14

    使用Spring Security的Oauth2请求令牌

  15. 15

    无法触发Spring Security OAuth2登录

  16. 16

    Spring Security,OAUTH2,动态客户端秘密

  17. 17

    使用Spring Security OAuth2的刷新令牌为null

  18. 18

    在Spring Security OAuth2中自定义TokenEndpoint

  19. 19

    用于春季网站的Spring Security Oauth2

  20. 20

    Spring Security - 用于 oAuth2 实现的 UserDetailsService?

  21. 21

    Spring security oauth2 修改响应体连接

  22. 22

    Spring Security 使用什么来生成 OAuth2 令牌?

  23. 23

    Javascript WebApp 的 Spring Security Oauth2 身份验证

  24. 24

    注销在 Spring Security OAuth2 中无法正常工作

  25. 25

    OAuth2 Spring Security-OAuth2AuthenticationProcessingFilter不起作用

  26. 26

    OAuth2 Spring Security-OAuth2AuthenticationProcessingFilter不起作用

  27. 27

    如何刷新的OAuth2令牌使用Spring Security 5 OAuth2用户端和RestTemplate

  28. 28

    如何仅为 Spring Boot Security OAuth2 应用程序中的某些类启用 OAuth2?

  29. 29

    如何使用XML使用Spring Security Oauth2启用/ oauth / check_token

热门标签

归档