16.11 SET_SCOPE Procedure

This procedure changes the "scope" attribute of a Web Credential. All existing tokens for the given credential are cleared.

Syntax

APEX_CREDENTIAL.SET_SCOPE (
    p_credential_static_id      IN VARCHAR2,
    p_scope                     IN VARCHAR2,
    p_named_scopes              IN VARCHAR2 DEFAULT NULL );

Parameters

Parameter Description
p_credential_static_id Credential static ID.
p_scope New scope value to store within the Web Credential.
p_named_scopes

JSON array with named scopes. If the invoker specifies a named scope, APEX uses the value from the property list. Specify NULL to leave the existing named scope list unchanged; an empty JSON array to clear the list, and a populated array to store the list. There is no merging functionality; the whole list is being replaced. For now, we use a VARCHAR2 parameter that restricts the JSON size to 32K.

Format:
[
    { "name": "sales", "value":"fusion-x-sls-scope" },
    :
]

Example 1

The following example sets scope for the credential "OAuth_Login."

BEGIN
    apex_credential.set_scope (
        p_credential_static_id => 'OAuth_Login',
        p_scope                => 'new-scope-value' );
END;

Example 2

The following example sets the scope for the credential "OAuth_Login."

declare
    l_named_scopes varchar2(32767) := '[ {"name":"sales", "value":"fusion-x-sls-scope"}'
                                   || ' ,{"name":"hr",    "value":"fusion-x-hr-scope" } ]';
begin
    apex_credential.set_scope (
        p_credential_static_id => 'OAuth_Login',
        p_scope                => 'hr',

        p_named_scopes         => l_named_scopes );
end;