Adnan
Adnan

Reputation: 27

OAuth 2 token getting error 401 unauthorized even after providing right credentials and token URL (Oracle APEX REST API)

In the restful services I created custom role (named "client_auth_custom") and assigned that to a module through privilege (also named "client_auth_custom"). The API Module URL is: https://[host]/ords/webapp/mod/emp Then I created an OAuth client from PL/SQL:

BEGIN
    OAUTH.CREATE_CLIENT (p_name              => 'client_user',
                         p_grant_type        => 'client_credentials',
                         p_support_email     => '[email protected]',
                         p_description       => 'oauth client user',
                         p_privilege_names   => 'client_auth_custom');

    OAUTH.GRANT_CLIENT_ROLE (p_client_name   => 'client_user',
                             p_role_name     => 'client_auth_custom');
    COMMIT;
END;

I got the client id and secret from:

SELECT * FROM USER_ORDS_CLIENTS where name = 'client_user';

When I am trying to get token from postman through this URL https://[host]/ords/webapp/oauth/token I am getting Error: Could not complete OAuth 2.0 token request with Error 401--Unauthorized error. The software is running on weblogic server, running on HTTPS and not HTTP. We are using NGINX for proxy pass.

If the same API is used without any authentication it works without issue. I have also disabled the Enable SSL certificate verification option in postman

APEX Version: 24.1.0
ORDS Version: 24.2.3.r2011847
Weblogic Version: 14.1.1

Upvotes: 0

Views: 115

Answers (0)

Related Questions