With the below client credentials, we are able to access bearer token and OIC integration instance all endpoints in postman. In Oracle APEX, i am able to get bearer token using oauth_authenticate but while calling REST Point using apex_web_service.make_rest_request getting below error:
{ "code" : "NotAuthenticated",
"message" : "The required information to complete authentication was not provided or was incorrect." }
script used:
declare
l_resp clob;
begin
apex_web_service.oauth_authenticate(
p_token_url => 'https://idcs-xxxxxxxxxxxxxxxxxxxxxxxx.identity.oraclecloud.com/oauth2/v1/token',
p_client_id => 'xxxxxxxxxxx',
p_client_secret => 'xxxxxxxxxxxxxxxxxxxxxxx,
p_scope => 'urn:opc:idm:__myscopes__');
dbms_output.put_line('Here is the API call result -> '||apex_web_service.oauth_get_last_token);
apex_web_service.g_request_headers(1).name := 'Authorization';
apex_web_service.g_request_headers(1).VALUE := 'Bearer ' || apex_web_service.oauth_get_last_token;
/* getting error in the below */
apex_web_service.g_request_headers(2).name := 'Content-TYPE';
apex_web_service.g_request_headers(2).value := 'application/json';
apex_json.initialize_clob_output(p_preserve => true);
l_resp := apex_web_service.make_rest_request(p_url =>
'https://design.integrationxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.oraclecloud.com/ic/api/integration/v1/monitoring/errors?integrationInstance=xxxxxxxxx',
p_http_method => 'GET');
dbms_output.put_line('Here is the API call result -> '||l_resp);
end;