14.11 SET_SESSION_TOKEN Procedure

This procedure sets a token into the provided credential for the duration of the current Oracle APEX session. The token is encrypted and can only be used by the current APEX session. Client ID and Client Secret are not stored in the credential by this procedure.


    p_credential_static_id  IN VARCHAR2,
    p_token_type            IN t_token_type,
    p_token_value           IN VARCHAR2,
    p_token_expires         IN DATE );


Parameters Description
p_credential_static_id The credential static ID.
p_token_type One of the constants C_TOKEN_ACCESS, C_TOKEN_REFRESH, or C_TOKEN_ID.
p_token_value The token value.
p_token_expiry The token expiry date.


The following example stores the OAuth access token with value sdakjjkhw7632178jh12hs876e38.. and expiry date of 2023-10-31 into the credential OAuth Login.

    apex_credential.set_session_token (
        p_credential_static_id => 'OAuth Login',
        p_token_type           => apex_credential.C_TOKEN_ACCESS,
        p_token_value          => 'sdakjjkhw7632178jh12hs876e38..',
        p_token_expires        => to_date('2023-10-31', 'YYYY-MM-DD') );