on 08-15-2017 12:42 PM
I'm implementing an SAP Cloud Platform Java application to connect to the Office 365 API (https://outlook.office.com/) using OAuth2 authentication.
When I running it on Apache Tomcat local server I get the response from the server correctly.
When I run the same code on SAP Cloud Platform I get javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated|
In both cases I get the correct OAuth token.
What am I missing here? The code I'm using is:
privateObject getResponseFromAzure(String url,String methodType){AuthenticationResult result =null;try{
result = getAccessTokenFromUserCredentials();// OAuth2 bearer token}catch(Exception e1){// TODO Auto-generated catch block
e1.printStackTrace();}String accessToken = result.getAccessToken();System.out.println("Access Token is - "+ accessToken);HttpClient client =newDefaultHttpClient();HttpRequestBase request =null;if("GET".equals(methodType)){
request =newHttpGet(url);}elseif("POST".equals(methodType)){
request =newHttpPost(url);}
request.addHeader("Authorization","Bearer "+ accessToken);HttpResponse response =null;try{
response = client.execute(request);}catch(ClientProtocolException e){// TODO Auto-generated catch block
e.printStackTrace();}catch(IOException e){// TODO Auto-generated catch block
e.printStackTrace();}
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.