oltu-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Sanso (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (OLTU-212) java.io.IOException: Server returned HTTP response code: 411 for URL: https://login.live.com/oauth20_token.srf?code=
Date Wed, 25 Oct 2017 18:32:01 GMT

     [ https://issues.apache.org/jira/browse/OLTU-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Antonio Sanso resolved OLTU-212.
--------------------------------
    Resolution: Fixed

> java.io.IOException: Server returned HTTP response code: 411 for URL: https://login.live.com/oauth20_token.srf?code=
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: OLTU-212
>                 URL: https://issues.apache.org/jira/browse/OLTU-212
>             Project: Apache Oltu
>          Issue Type: Improvement
>            Reporter: Prateek
>
> I am extending the question from the below link: [Apache OLTU Microsoft Integration Failed]
and how facing the new issue/error shown below.
>    
> {code:java}
>  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 java.lang.reflect.Method.invoke(Unknown Source)
>     	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
>     	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
>     	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
>     	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
>     	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
>     	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
>     	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
>     	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
>     	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
>     	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
>     	at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
>     	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
>     	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>     	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>     	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>     	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>     	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>     	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>     	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
>     	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
>     	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
>     	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
>     	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
>     	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
>     	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
>     	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
>     	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
>     	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
>     	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
>     	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
>     	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
>     	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>     	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>     	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>     	at java.lang.Thread.run(Unknown Source)
> {code}
> I used the following code and here I see some issues, please guide me now
> {code:java}
>     private static final String AUTH_URL = "https://login.live.com/oauth20_authorize.srf";
>     private static final String TOKEN_URL = "https://login.live.com/oauth20_token.srf";
> {code}
> and the code which I used
>    
> {code:java}
>  OAuthClientRequest request = OAuthClientRequest
>     		.tokenLocation(TOKEN_URL)
>     		.setGrantType(GrantType.AUTHORIZATION_CODE)
>     		.setClientId(CLIENT_ID)
>     		.setClientSecret(CLIENT_SECRET)
>     		.setRedirectURI(REDIRECT_URL)
>     		.setCode(authorizationCode)
>     		.buildQueryMessage();
>     
>     OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
>     OAuthAccessTokenResponse oAuthResponse = oAuthClient.accessToken(request);
>     
>     request= new OAuthBearerClientRequest
>     		("https://login.microsoftonline.com/common/oauth2/v2.0/authorize?oauth2_access_token="+oAuthResponse.getAccessToken()).
>     		buildQueryMessage();
>     
>     
>     OAuthClient client = new OAuthClient(new URLConnectionClient());
>     OAuthResourceResponse resourceResponse= client.resource(request, "GET", OAuthResourceResponse.class);
> Although I used the below URL's but still the error comes:
>     private static final String AUTH_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
>     private static final String TOKEN_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
> Here is the error aagain:
>     OAuthClientRequest request = OAuthClientRequest
>     		.tokenLocation(TOKEN_URL)
>     		.setGrantType(GrantType.AUTHORIZATION_CODE)
>     		.setClientId(CLIENT_ID)
>     		.setClientSecret(CLIENT_SECRET)
>     		.setRedirectURI(REDIRECT_URL)
>     		.setCode(authorizationCode)
>     		.buildQueryMessage();
>     
>     OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
>     
>     OAuthAccessTokenResponse oAuthResponse = oAuthClient.accessToken(request);
>     
>     request= new OAuthBearerClientRequest
>     		("https://login.microsoftonline.com/common/oauth2/v2.0/authorize?oauth2_access_token="+oAuthResponse.getAccessToken()).
>     		buildQueryMessage();
>     
>     
>     OAuthClient client = new OAuthClient(new URLConnectionClient());
>     OAuthResourceResponse resourceResponse= client.resource(request, "GET", OAuthResourceResponse.class);
> {code}
> **The latest error:**
>    
> {code:java}
>  java.io.IOException: Server returned HTTP response code: 411 for URL: https://login.microsoftonline.com/common/oauth2/v2.0/token?code=AQABAAIAAAABlDrqfEFlSaui6xnRjX5EPkNxLtNNIc66oXsqD0EuTpbgn1hjG330DwFSNW5_1-NL4Oct4vrKqd7Gmlrb2umO3InNcYBM23JiXM_d3jM2EI0PCOzHZ1LHsXLAva4dTRK2F8KYRNPOG9pAqBCyD8PcZWjE8jGWxWKL-bH36tLTumctc6kkMYRAK6e7JfslCC2E0m3vhEo9ROpVgbxXD5RvZI6Zp80qriMXNg9MqvI47kboRUhT7nuVvrjOguCqO-0AeG0Z0lQ2bbpXQG_LZxgkLw5f6xq2ILfhuyVKU5vl9XhX0AIr0imUdCO7J8j2aJpzMwKG1DCAgAvBmRy4TDe4mfvUprDkXQo80COKck9w3Tloakvn-PvUA2ikknZOW5rt-wnMmaj7cQkycUFpBFR2OJZ5B_9v4re8tC7NWJxhammCxADOoX44r7q0Wv7R-GhyuIzUJBjtE4miMJKO5s96KP7QylSdBcmXYmOSt9229Vxw1c79wh88izs3TR0EzHMMZ5VajpKit9vhLQ5CE7Qv_wafIar7UXtPFO9JKXJRnjySSlvchLXm-IyqacTBtIDaxg2bjFSN65i3vlyCXxFM2vGgQdlWNcA2LkK6NekyZAAl4O_IxrC24SDoK2lI1Pov320D32e3qw7sF-01h6Xy23FJS38SKuU2qpLoGuwA_tSK3sSKDjUCH8vfAT8V8JASXTbHCeehdA6M_HK4IwRFIAA&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:84)
>     	at com.apache.oltu.MicrosoftController.redirect(MicrosoftController.java:61)
>     	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     	at java.lang.reflect.Method.invoke(Unknown Source)
>     	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
>     	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
>     	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
>     	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
>     	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
>     	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
>     	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
>     	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
>     	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
>     	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
>     	at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
>     	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
>     	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
>     	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
>     	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>     	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>     	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
>     	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
>     	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
>     	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
>     	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
>     	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
>     	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
>     	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
>     	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
>     	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
>     	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
>     	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
>     	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
>     	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
>     	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
>     	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>     	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>     	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>     	at java.lang.Thread.run(Unknown Source)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message