10.9 SET_SESSION_TOKEN Procedure
This procedure uses an autonomous transaction in order to store the token in the database table.
Stores a token into a credential store which is obtained with manual or custom PL/SQL code. The credential store saves this token in encrypted form for subsequent use by Application Express components. The token is stored for the lifetime of the Application Express session. Other sessions cannot use this token. When tokens are obtained with custom PL/SQL code, Client ID, and Client Secret are not stored in that credential store – it contains the tokens set by this procedure only.
Syntax
PROCEDURE SET_SESSION_TOKEN(
    p_credential_static_id  IN VARCHAR2,
    p_token_type            IN t_token_type,
    p_token_value           IN VARCHAR2,
    p_token_expires         IN DATE );
Parameters
Table 10-7 SET_SESSION_TOKEN Procedure Parameters
| Parameters | Description | 
|---|---|
| 
 | The credential static ID. | 
| 
 | The token type:  | 
| 
 | The value of the token. | 
| 
 | The expiry date of the token | 
Example
The following example stores OAuth2 access token with value sdakjjkhw7632178jh12hs876e38.. and expiry date of 2017-10-31 into  credential OAuth Login.
                  
begin
     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('2017-10-31', 'YYYY-MM-DD') );
end;Parent topic: APEX_CREDENTIAL