SqlConnection.AccessToken Property

Definition

Gets or sets the access token for the connection.

public:
 property System::String ^ AccessToken { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
public string AccessToken { get; set; }
public string AccessToken { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.AccessToken : string with get, set
member this.AccessToken : string with get, set
Public Property AccessToken As String

Property Value

The access token for the connection.

Attributes

Exceptions

The AccessToken is combined with other conflicting authentication configurations.

Remarks

The AccessToken is a part of the connection pool key. Supplying a refreshed access token to a new connection, with all other properties the same as other existing connections, will place that new connection into a new pool. Care should be taken when using this property to manage your own access token. Consider using the AccessTokenCallback property instead, which will not consider refreshed access tokens as distinct for the purposes of connection pooling.

The application is responsible for knowing when the access token expires and the connections from the pool should no longer be used. If you set a minimum pool size > 0 along with an AccessToken, you must call ClearPool(SqlConnection) after the access token expires to ensure the connection pool doesn't maintain the physical connections (created by the pool) indefinitely.

This property is mutually exclusive with the AccessTokenCallback property, among others.

Applies to