Idea Summary
SQL Workshop > RESTful Services is a great place to define REST APIs, but it is missing the final piece, creating OAuth2 clients to access the protected APIs. Currently, after the APIs have been built, you must connect as the schema the APIs are owned by and run a script like this:
DECLARE
l_client_name user_ords_clients.name%TYPE := 'OAuth2 Client 123';
BEGIN
oauth.create_client (p_name => l_client_name,
p_grant_type => 'client_credentials',
p_description => 'Access some APIs',
p_support_email => 'ej.egyed@nowhere.com',
p_privilege_names => '');
oauth.grant_client_role (p_client_name => l_client_name,
p_role_name => 'Upload Report Role');
COMMIT;
END;
/
After the client has been created, you will need to run a query like this to get the Client ID and Client Secret:
SELECT name, client_id, client_secret FROM user_ords_clients;
It would be awesome if there was a way to create and view OAuth2 clients (including Client ID/Secret) and manage their role assignments from within APEX.
Use Case
In our applications, the schema that owns the REST APIs is typically a locked schema or lacks the privileges to create a session via SQLPlus/SQLcl. This requires us to unlock the schema, grant the necessary privileges, run the code to create the new OAuth2 clients, revoke the grants, and lock the schema again. This would not be required if the clients could be managed from SQL Workshop > RESTful Services.
Preferred Solution (Optional)
On the SQL Workshop > RESTful Services page, add one more option to the tree that allows developers to create, delete, and manage role assignments for OAuth2 clients. If a newer version of ORDS is installed in the database, the ability to rotate a client secret should also be included.
