I have added an external OData REST Service as a REST Data Source in my APEX application. Defined a LOV against this REST Data Source and it is being shown as a Popup.
I have another external service which is secured with JWT. How can i pass the token in REST Data Source definition (for example via Web Credential) to have the same above functionality?
For example if i am calling the service from PL/SQL then i would pass JWT as
apex_web_service.g_request_headers(1).name := 'Authorization';
apex_web_service.g_request_headers(1).value := 'Bearer ' || 'my JWT';
RESP_JSON := APEX_WEB_SERVICE.MAKE_REST_REQUEST(
P_URL => URL,
P_HTTP_METHOD => 'get'
);
Authentication Type: OAuth2 Client Credentials Flow is not required as i don't have Client ID and Secret as well as a specifc endpoint to acquire token.
I have tried this with the REST Data Source, no success
No Authentication
Parameters
Name: Authorization
Value: Bearer :GLOB_TOKEN
Any Application Item mentioned in Parameters is not resoved because one of the debug message is
default value for parameter (1) "Authorization" is "Bearer :GLOB_TOKEN"
Then what is the purpose of Static
flag (which is off in my added parameter)?
You could create a Web Credential of the HTTP Header type. Then use Authorization as the name (key) and Bearer {JWT} as the value. Then simply assign the credential to the REST Source.
You can then use APEX_CREDENTIAL.SET_SESSION_CREDENTIALS or APEX_CREDENTIAL.SET_PERSISTENT_CREDENTIAL to change the token value if required.
The credential will work on the HTTP Header level, and it won’t be aware that this is a JWT; but things should just work.