AccessToken
This property is used to get or set OracleAccessToken on the connection.
Declaration
// C#
public OracleAccessToken AccessToken { get; set; }Property Value
An OracleAccessToken object containing a database token and private key, or an access token, used for opening a connection.
Exceptions
-
An
InvalidOperationExceptionwill be raised if-
the connection is already open,
-
the value of the
TokenAuthenticationproperty is not compatible with the type of token being set. This is applicable for managed ODP.NET and ODP.NET Core only, -
TokenAuthenticationhas been set by the application as disabled, or theTokenLocationproperty is set. This is applicable for managed ODP.NET and ODP.NET Core only. -
The
Credentialproperty is set. -
Or, the user or proxy information in the connection string is not compatible with token authentication.
-
-
ArgumentNullExceptionif any argument is null. -
OracleExceptionif Credential is set. -
OracleExceptionif user id value is other than/. -
OracleExceptionif password, proxy user id and proxy password is set.
Description
If the token represents the same identity, then the same OracleAccessToken object should be set on the OracleConnection. The OracleAccessToken object, not the token, is used to identify the connection pool.
If an access token has expired, then OracleConnection.OpenWithNewToken must be called to open a new connection. Since the OracleAccessToken object cannot be modified, it is not possible to specify a refreshed access token on the AccessToken property. However, existing connections can still be dispensed, even after the access token has expired.
In unmanaged ODP.NET, if CPVersion is not set to any value, AccessToken property is set by the application, and Open() method is invoked, then the connection will set the value of CPVersion to 2.0. CPVersion cannot be set to 1.0 in this scenario. Doing so will result in an exception.