Edit

Share via


AuthenticationHeaderValue Constructors

Definition

Initializes a new instance of the AuthenticationHeaderValue class.

Overloads

AuthenticationHeaderValue(String)

Initializes a new instance of the AuthenticationHeaderValue class.

AuthenticationHeaderValue(String, String)

Initializes a new instance of the AuthenticationHeaderValue class.

AuthenticationHeaderValue(String)

Source:
AuthenticationHeaderValue.cs
Source:
AuthenticationHeaderValue.cs
Source:
AuthenticationHeaderValue.cs

Initializes a new instance of the AuthenticationHeaderValue class.

public:
 AuthenticationHeaderValue(System::String ^ scheme);
public AuthenticationHeaderValue (string scheme);
new System.Net.Http.Headers.AuthenticationHeaderValue : string -> System.Net.Http.Headers.AuthenticationHeaderValue
Public Sub New (scheme As String)

Parameters

scheme
String

The scheme to use for authorization.

Remarks

Example:

HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(ACCESS_TOKEN);
Dim client = New HttpClient()
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(ACCESS_TOKEN)

Will produce the following header:

Authorization: ACCESS_TOKEN

Applies to

AuthenticationHeaderValue(String, String)

Source:
AuthenticationHeaderValue.cs
Source:
AuthenticationHeaderValue.cs
Source:
AuthenticationHeaderValue.cs

Initializes a new instance of the AuthenticationHeaderValue class.

public:
 AuthenticationHeaderValue(System::String ^ scheme, System::String ^ parameter);
public AuthenticationHeaderValue (string scheme, string parameter);
public AuthenticationHeaderValue (string scheme, string? parameter);
new System.Net.Http.Headers.AuthenticationHeaderValue : string * string -> System.Net.Http.Headers.AuthenticationHeaderValue
Public Sub New (scheme As String, parameter As String)

Parameters

scheme
String

The scheme to use for authorization.

parameter
String

The credentials containing the authentication information of the user agent for the resource being requested.

Remarks

Example:

HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ACCESS_TOKEN);
Dim client = new HttpClient()
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ACCESS_TOKEN)

Will produce the following header:

Authorization: Bearer ACCESS_TOKEN

Applies to