Tag: oauth2client

使用Java中的Apache OAuth客户端2.0库生成授权代码和用户令牌的问题

我尝试使用Java中的Apache OAuth Client 2.0库自动化用户级令牌创建/生成过程(REST /授权授权代码)。 以下是我使用的代码,我从https://cwiki.apache.org/confluence/display/OLTU/OAuth+2.0+Client+Quickstart获取 , `/*Previous Codes & starting the below with Try/Catch*/ OAuthClientRequest request = OAuthClientRequest .authorizationLocation(“Authorization URL”) .setClientId(“ClientID”) .setRedirectURI(“Redirect URL”) .buildQueryMessage(); request.getLocationUri(); OAuthAuthzResponse oar = OAuthAuthzResponse.oauthCodeAuthzResponse(request); String code = oar.getCode(); /*Other Codes and starting the below with Try/Catch*/ OAuthClientRequest request = OAuthClientRequest .tokenLocation(“TokenEndPointURL”) .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(“ClientID”) .setClientSecret(“ClientSecret”) .setRedirectURI(“REdirectURL”) .setCode(code)//Authorization Code from above […]