Dear experts,
I have a scenario REST Sender Polling -> PO 7.5 -> IDoc Receiver.
My REST Sender adapter must connect to Microsoft CRM Dynamics 365 using "OAuth 2.0 Grants Type Flow". I can retrieve the token but my HTTP Request fails with Error 401-Unauthorized.
With the Postman App it is possible for me to connect.
My setup of the REST Polling Sender Adapter on SAP PO 7.5:
I traced it with XPI Inspector:
HTTP_CLIENT : 165 REQUEST:
POST /*****.onmicrosoft.com/oauth2/token?resource=https://******.crm4.dynamics.com HTTP/1.1
Authorization: Basic MjdhO******
Content-Type: application/x-www-form-urlencoded
User-Agent: SAP HttpClient v1.0
Host: login.microsoftonline.com
Content-Length: 29
HTTP_CLIENT : 165 REPLY:
HTTP/1.1 200 OK.
HTTP_CLIENT : 165 REPLY:
{"token_type":"Bearer","expires_in":"3600","ext_expires_in":"0","expires_on":"1538140432","not_before":"1538136532",
"resource":"00000002-0000-0000-c000-000000000000",
"access_token":"eyJ0eX*******
HTTP_CLIENT : 166 REQUEST:
GET /api/data/v9.0/accounts?%24select=accountnumber&=eyJ0eX*******
HTTP_CLIENT : 166 REPLY:
HTTP/1.1 401 Unauthorized..Cache-Control: private
Content-Type: text/html
Server: Set-Cookie: ReqClientId=5e5dc254-76d3-4580-aaf7-8c703338e195;
expires=Fri, 28-Sep-2068 12:13:52 GMT; path=/; secure;
HttpOnlyWWW-Authenticate: Bearer authorization_uri=https://login.microsoftonline.com/db3ec******/oauth2/authorize, resource_id=https://******.crm4.dynamics.com/
x-ms-service-request-id: 44*******
REQ_ID: 44*******
x-authentication-ticketid: f66********
Set-Cookie: ApplicationGatewayAffinity=103f8********
Path=/;Domain=*******.crm4.dynamics.com
Date: Fri, 28 Sep 2018 12:13:52 GMT
Content-Length: 49
To my token request I get a 200 OK back.
I am also getting a token back which is good.
But my HTTP request for accounts: GET /api/data/v9.0/accounts?%24select=accountnumber&=eyJ0eX*******
is getting the 401 Unauthorized reply!
I feel like the token I am receiving from my token request is not used in my HTTP request. My biggest question mark are the HTTP headers: I am doing something wrong there. Who has an idea how to set the HTTP Headers?
Thank you,
Peter