I can add a user to an app through the API via Postman and the Oktakit ruby gem. When performing what should be the same request through Merge, it returns a 400. Other Merge passthrough requests are working, it’s just the POST to {{url}}/api/v1/apps/{{appId}}/users
that’s not working.
Request:
payload = {
method: "POST",
headers: {
Accept: "application/json",
ContentType: "application/json"
},
path: "/api/v1/apps/#{@okta_app_id}/users",
data: {
id: @okta_user_id || "",
scope: "USER"
}
}
response = api_instance.passthrough_create(access_token, payload)
Response:
{:errorCode=>"E0000021",
:errorSummary=>"Bad request. Accept and/or Content-Type headers likely do not match supported values.",
:errorLink=>"E0000021",
:errorId=>"oaew11VolvfReORLaZtMdGS2A",
:errorCauses=>[]}
It’s not the suggested issue of Accept and/or Content-Type. Here’s the request headers in the MergeHRISClient object:
#<MergeHRISClient::RemoteResponse:0x000000010d600de8
@headers=
{:"User-Agent"=>"Mozilla/5.0",
:"Accept-Encoding"=>"gzip, deflate, br",
:Accept=>"application/json",
:Connection=>"keep-alive",
:Authorization=>"<redacted>",
:ContentType=>"application/json",
:"Content-Length"=>"47",
:"x-datadog-trace-id"=>"15018062895474666192",
:"x-datadog-parent-id"=>"15035386594106804400",
:"x-datadog-sampling-priority"=>"1"},
@method="POST",
@path="/api/v1/apps/<app-id>/users",
...
>
Calling .to_json
on the body has the same effect. I’ve compared working Postman requests to the Merge <=> Okta request and I don’t see any real difference.