Tag: oltu

无法从salesforce站点重定向回Spring Boot JSP

我正在开发Spring Boot + Apache Oltu + Salesforce Integration示例。 在这个例子中,我试图调用Salesforce URL,但它应该通过Controller进行,但不会被调用。 问题是什么? 在后端,以下是执行,但不知道为什么它不重定向? 有什么快速帮助? @RequestMapping(value = “/redirect”, method = RequestMethod.GET) public HttpEntity redirect( @RequestParam(value = “code”, required = false) String code) throws OAuthSystemException, OAuthProblemException { String value = “UNKNOWN”; if (code != null && code.length() > 0) { System.out.println(“Received CODE: “+code); String details = getAccessToken(code); value […]

Apache Oltu + Foursquare集成无法正常工作

我正在开发Spring + Apache Oltu + Foursquare集成示例。 在此示例中,我在此处创建了一个应用程序: https : //developer.foursquare.com/并使用CLIENT_ID和CLIENT_SECRET来调用Foursquare REST API。 有帮助吗? 我收到以下错误: 接收的码:JMGKOSW4RGUPDXCNVQEN42K34UQKHMNGQIAUFY1WLGAMMMEN POSTING:收稿ACCESS_TOKEN:[L3PM3PJFRJAELBM4H3LQ431QGGEIN13RLKPJKNAFFARHT20F] { “的access_token”: “L3PM3PJFRJAELBM4H3LQ431QGGEIN13RLKPJKNAFFARHT20F”}无法访问资源:400 { “元”:{ “代码”:400, “错误类型”: “invalid_auth”,“errorDetail “:”缺少访问凭据。有关详细信息,请参阅https://developer.foursquare.com/docs/oauth.html。“,”requestId“:”59f225be4434b957cad65338“},”response“:{}} 我使用了以下内容: AUTHORIZATION_URL = “https://foursquare.com/oauth2/authenticate”; ACCESS_TOKEN_URL = “https://foursquare.com/oauth2/access_token”; 我使用下面的代码,但看起来像API调用中的一些问题。 请指导 private String getAccessToken(String authorizationCode) throws OAuthSystemException, OAuthProblemException { OAuthClientRequest request = OAuthClientRequest .tokenLocation(ACCESS_TOKEN_URL) .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(CLIENT_ID) .setClientSecret(CLIENT_SECRET) .setRedirectURI(REDIRECT_URL) .setCode(authorizationCode) .buildQueryMessage(); //create OAuth […]

无法访问资源:401 – 仅适用于RestClient插件

我正在使用Postman(Chrome插件)和RestClient(Mozilla插件)​​,当我通过Postman执行时它不起作用。 但是同样使用Rest CLient执行它然后它工作。 即使是相同的我执行代码 OAuthClientRequest request = OAuthClientRequest .tokenLocation(ACCESS_TOKEN_URL) .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(CLIENT_ID) .setClientSecret(CLIENT_SECRET) .setRedirectURI(REDIRECT_URL) .setCode(authorizationCode) .buildQueryMessage(); //create OAuth client that uses custom http client under the hood OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient()); OAuthAccessTokenResponse oAuthResponse = oAuthClient.accessToken(request); System.out.println(oAuthResponse.getBody()); request= new OAuthBearerClientRequest(“https://ap5.salesforce.com//services/data/v40.0/”). setAccessToken(oAuthResponse.getAccessToken()). buildBodyMessage(); OAuthClient client = new OAuthClient(new URLConnectionClient()); OAuthResourceResponse resourceResponse= client.resource(request, “GET”, OAuthResourceResponse.class); if (resourceResponse.getResponseCode()==200){ […]

Spring MVC Apache Oltu和Salesforce Integration示例OAUTH_APPROVAL_ERROR_GENERIC:身份validation期间发生了意外错误

我在这里扩展问题: java.io.IOException:服务器返回HTTP响应代码:411为URL:https://login.live.com/oauth20_token.srf?code = 我正在开发Spring MVC + Apache Oltu + Salesforce Integration示例。 在此示例中,我在salesforce中创建了连接的App,如下所示: 在这个例子中,我在下面使用: ACCESS_TOKEN_URL =“ https://login.salesforce.com/services/oauth2/token ” AUTHORIZATION_URL =“ https://login.salesforce.com/services/oauth2/authorize ”; 什么是OAuthBearerClientRequest请求? 和Github一样,我使用过https://api.github.com/user 。 salesforce的URL是什么? 这是从我的代码调用: https://login.salesforce.com/services/oauth2/authorize?scope=full&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapache-oltu%2Fsalesforce%2Fredirect&client_id=3MVG9d8..z.hDcPJZPIzGJ5UZDqJOJY.3R6RBM8sJAF8PyTtdTE.DDBnScvPEbcbUmaZ1HQjYItOLpnjY4JHL 但授权中没有任何内容。 例如: OAuthBearerClientRequest for Linkedin – https://api.linkedin.com/v1/people/~?oauth2_access_token= Facebook – https://graph.facebook.com/me/friends Github- https://api.github.com/user //api.github.com/user 什么是销售人员? 此URL也没有我想要的信息: https : //developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com#Obtaining_an_Access_Token_using_a_SAML_Bearer_Assertion 。 如果有人需要代码供参考,请告诉我。 我看到的错误:: error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration 这里提到的问题: https : //issues.apache.org/jira/browse/OLTU-210

使用Oltu传递给OAuthTokenRequest时无法使用@ Context HttpServletRequest检索发布数据

我正在使用Oltu作为Oauth2。 使用@Context HttpServletRequest请求时,我无法检索发布数据 当我使用@FormParam时,我能够检索发布数据。 在将请求传递给OAuthTokenRequest时 OAuthTokenRequest oauthRequest = new OAuthTokenRequest(request); 我收到了以下错误 {“error”:“invalid_request”,“error_description”:“缺少grant_type参数值”} 在oltu OAuthTokenRequest类上进行调试时,使用以下代码来检索param值 public String getParam(String name) { return this.request.getParameter(name); // from request it is unable to get post data.As i am getting request object using @Context HttpServletRequest request . } 据说使用@Context HttpServletRequest请求无法获取使用@Context HttpServletRequest请求的post数据所以,我的问题是 如何在jax-ws中获取带有post数据的HttpServletRequest请求,以便我可以将HttpServletRequest请求传递给OAuthTokenRequest这是我的代码 @Path(“/token”) public class TokenEndpoint { @POST @Consumes(“application/x-www-form-urlencoded”) @Produces(“application/json”) public […]

OAuth 2.0生成令牌和秘密令牌

我正在使用Apache Oltu框架实现OAuth 2.0提供程序服务器,寻找有关如何在java中生成访问令牌和秘密令牌的一些想法。 请指教。

java.io.IOException:服务器返回HTTP响应代码:411为URL:https://login.live.com/oauth20_token.srf?code =

我正在从以下链接扩展问题: Apache Oltu + Microsoft Integration – OAuthProblemException {error =’invalid_request’,description =’缺少必需参数,包括无效以及如何面对下面显示的新问题/错误。 java.io.IOException: Server returned HTTP response code: 411 for URL: https://login.live.com/oauth20_token.srf?code=M60698e36-f569-4e8e-18ea-b0837bc88f78&grant_type=authorization_code&client_secret=RYbo4yBdvzg4R9oxkNGG0Tr&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapache-oltu%2Fmicrosoft%2Fredirect&client_id=23e101f2-e00b-416f-a7f8-5f85cc5cd87b at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source) at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:97) at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65) at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55) at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71) at com.apache.oltu.MicrosoftController.getAccessToken(MicrosoftController.java:80) at com.apache.oltu.MicrosoftController.redirect(MicrosoftController.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at […]

Apache Oltu Instragram集成不返回access_token …为什么?

我正在开发Spring MVC + Apache Oltu + Instagram示例。 在这个例子中,我在https://www.instagram.com/developer/上创建了一个App,我得到了ClientId和Client_Secrete 。 使用此clientId和Client Secrete Secrete,调用Instagram Rest EndPoints 。 但是当调用REST EndPoint时,我收到以下错误: SEVERE: Servlet.service() for servlet [appServlet] in context with path [/apache-oltu] threw exception [Request processing failed; nested exception is OAuthProblemException{error=’invalid_request’, description=’Missing parameters: access_token’, uri=’null’, state=’null’, scope=’null’, redirectUri=’null’, responseStatus=0, parameters={}}] with root cause OAuthProblemException{error=’invalid_request’, description=’Missing parameters: access_token’, uri=’null’, state=’null’, scope=’null’, […]