I'm having trouble assigning more than one privilege to an OAUTH client using SQL*Plus on Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production and ORDS 3.0.1.177.18.02.
Initially I created a client with only a single privilege and then attempted to use OAUTH.UPDATE_CLIENT to add a second privilege. From the documentation it appears that I need to pass both the current and the new privilege as a comma separated list to the P_PRIVILEGE_NAMES parameter like this:
SQL> begin
oauth.update_client(
p_name => 'Test_Client',
p_grant_type => 'client_credentials',
p_privilege_names => 'tst.privilege1, tst.privilege2');
commit;
end;
oauth.update_client(
*
ERROR at line 2:
ORA-06550: line 2, column 2:
PLS-00306: wrong number or types of arguments in call to 'UPDATE_CLIENT'
ORA-06550: line 2, column 2:
PL/SQL: Statement ignored
After further investigation, I see that the UPDATE_CLIENT procedure has a different data type for P_PRIVILEGE_NAMES than what the documentation describes:
PROCEDURE UPDATE_CLIENT
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
P_NAME VARCHAR2 IN
P_OWNER VARCHAR2 IN
P_DESCRIPTION VARCHAR2 IN
P_GRANT_TYPE VARCHAR2 IN
P_REDIRECT_URI VARCHAR2 IN
P_PRIVILEGE_NAMES T_ORDS_VCHAR_TAB IN
Then I checked on OAUTH.CREATE_CLIENT and noticed that it uses a VARCHAR2 type for this parameter, so I tried to delete the existing client and create it again (this time with both privileges) which also didn't work:
SQL> begin
oauth.create_client(
p_name => 'Test_Client',
p_grant_type => 'client_credentials',
p_privilege_names => 'tst.privilege1, tst.privilege2',
p_support_email => 'support@example.com');
commit;
end;
begin
*
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at "ORDS_METADATA.OAUTH", line 29
ORA-06512: at "ORDS_METADATA.OAUTH", line 340
ORA-06512: at "ORDS_METADATA.OAUTH", line 634
ORA-06512: at line 2
What is the proper method for assigning more than one privilege to a client?