Search code examples
plsqloauth-2.0oracle-apex-19.1oracle-rest-data-services

Oracle Apex - OAuth token generated in HTML format


On a complete new environment I have created restful services.

Using PLSQL,
Through below code on SQL developer when tried, I received ORA-20001: Authentication failed.

BEGIN
    APEX_WEB_SERVICE.OAUTH_AUTHENTICATE(
        P_TOKEN_URL     => 'http://<host:ip>/ords/<schema>/oauth/token',
        P_CLIENT_ID     => 'xxxxxxxxxxBaDNGqSq1atg..',
        P_CLIENT_SECRET => 'xxxxxxxxxx5NlSRSoeJrUw..');
    DBMS_OUTPUT.PUT_LINE(APEX_WEB_SERVICE.OAUTH_GET_LAST_TOKEN);
END;

Using Curl,
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials" -d "client_id=xxxxxxxxxxBaDNGqSq1atg.." -d "client_secret=xxxxxxxxxx5NlSRSoeJrUw.." "http://<host:ip>/ords/<schema>/oauth/token"

I received html code, And in preview format I got enter image description here

Using Postman,
I receive below response while generating token. enter image description here enter image description here

And when saved as html format, I saw below output, enter image description here

FYR,
below are the applied settings on ORDS. ORDS was restarted recently. enter image description here


Solution

  • It seemed, there was another port on the same server where idcs has been tested. Thus, the access token URL was redirecting towards the idcs.

    After removing the connectivity, we found another issue and reported here, ORDS: Error 401--Unauthorized From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.4.2 401 Unauthorized