SocketTools .NET Edition

HttpClient.Authentication Property

Gets and sets the method used to authenticate the client session.

[Visual Basic]
Public Property Authentication As HttpAuthentication
[C#]
public HttpClient.HttpAuthentication Authentication {get; set;}

Property Value

A HttpAuthentication enumeration value which specifies the authentication method.

Remarks

By default, no authentication is used when accessing a resource on the web server. Setting the UserName or Password property will automatically set the authentication type to use Basic unless a different method has already been specified.

Changing the value of the BearerToken property will automatically set the current authentication method to use Bearer.

You should only use the Bearer authentication method if you understand the process of how to request the access token. Obtaining an access token requires registering your application with the web service provider (e.g.: Microsoft or Google), getting a unique client ID associated with your application and then requesting the access 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 the service.

See Also