java - Peer not authenticated exception when connecting SAP Cloud Platform to Office 365 API -
i'm implementing sap cloud platform java application connect office 365 api (https://outlook.office.com/) using oauth2 authentication. when running on apache tomcat local server response server correctly. when run same code on sap cloud platform javax.net.ssl.sslpeerunverifiedexception: peer not authenticated| in both cases correct oauth token. missing here? code i'm using is:
private object 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 - " + accesstoken); httpclient client = new defaulthttpclient(); httprequestbase request = null; if ("get".equals(methodtype)) { request = new httpget(url); } else if ("post".equals(methodtype)) { request = new httppost(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(); }
create destination in scp. upload root , intermediate certificates in destination service. part of ui.
connect java application using destination instead of direct connection. example code available @ https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/cloud/en-us/e592cf6cbb57101495d3c28507d20f1b.html
Comments
Post a Comment