Gets and sets the bearer token used with OAuth 2.0 authentication.
Returns a string which contains the bearer token. Assigning a value to this property sets the current authentication type to use OAuth 2.0 authentication and updates the bearer token.
Assigning a value to the BearerToken property will automatically change the current authentication method to use OAuth 2.0 if necessary.
You should only use an OAuth 2.0 authentication method if you understand the process of how to request the access token. Obtaining a bearer token requires registering your application with the mail service provider (e.g.: Microsoft or Google), getting a unique client ID associated with your application and then requesting the bearer token using the appropriate scope for the service. Obtaining the initial token will typically involve interactive confirmation on the part of the user, requiring they grant permission to your application to access their mail account.
Your application should not store the bearer token for later use. They usually have a relatively short lifespan, typically about an hour, and are designed to be used with the current client session. You should specify offline access as part of the OAuth 2.0 scope, and store the refresh token provided by the service. The refresh token has a much longer validity period and can be used to obtain a new access token when needed.
If the current authentication method does not use OAuth 2.0, this property will return an empty string and you should use the Password property to obtain the current user password.
SmtpClient Class | SocketTools Namespace | Authentication Property | Password Property | UserName Property