AuthenticationTokenExtensions.GetTokenAsync Method

Definition

Overloads

GetTokenAsync(AuthenticationManager, String)
GetTokenAsync(IAuthenticationService, HttpContext, String)

Authenticates the request using the specified authentication scheme and returns the value for the token.

GetTokenAsync(AuthenticationManager, String, String)
GetTokenAsync(IAuthenticationService, HttpContext, String, String)

Authenticates the request using the specified authentication scheme and returns the value for the token.

GetTokenAsync(AuthenticationManager, String)

C#
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.Authentication.AuthenticationManager manager, string tokenName);

Parameters

tokenName
String

Returns

Applies to

ASP.NET Core 1.1 and ASP.NET Core 1.0
Product Versions
ASP.NET Core 1.0, 1.1

GetTokenAsync(IAuthenticationService, HttpContext, String)

Source:
TokenExtensions.cs
Source:
TokenExtensions.cs
Source:
TokenExtensions.cs

Authenticates the request using the specified authentication scheme and returns the value for the token.

C#
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string tokenName);
C#
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string tokenName);

Parameters

context
HttpContext

The HttpContext context.

tokenName
String

The name of the token.

Returns

The value of the token if present.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

GetTokenAsync(AuthenticationManager, String, String)

C#
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Http.Authentication.AuthenticationManager manager, string signInScheme, string tokenName);

Parameters

signInScheme
String
tokenName
String

Returns

Applies to

ASP.NET Core 1.1 and ASP.NET Core 1.0
Product Versions
ASP.NET Core 1.0, 1.1

GetTokenAsync(IAuthenticationService, HttpContext, String, String)

Source:
TokenExtensions.cs
Source:
TokenExtensions.cs
Source:
TokenExtensions.cs

Authenticates the request using the specified authentication scheme and returns the value for the token.

C#
public static System.Threading.Tasks.Task<string> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string scheme, string tokenName);
C#
public static System.Threading.Tasks.Task<string?> GetTokenAsync (this Microsoft.AspNetCore.Authentication.IAuthenticationService auth, Microsoft.AspNetCore.Http.HttpContext context, string? scheme, string tokenName);

Parameters

context
HttpContext

The HttpContext context.

scheme
String

The name of the authentication scheme.

tokenName
String

The name of the token.

Returns

The value of the token if present.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0