Partilhar via


JsonWebTokenHandler.ReadJsonWebToken(String) Method

Definition

Converts a string into an instance of JsonWebToken.

public virtual Microsoft.IdentityModel.JsonWebTokens.JsonWebToken ReadJsonWebToken (string token);
abstract member ReadJsonWebToken : string -> Microsoft.IdentityModel.JsonWebTokens.JsonWebToken
override this.ReadJsonWebToken : string -> Microsoft.IdentityModel.JsonWebTokens.JsonWebToken
Public Overridable Function ReadJsonWebToken (token As String) As JsonWebToken

Parameters

token
String

A JSON Web Token (JWT) in JWS or JWE Compact Serialization format.

Returns

A JsonWebToken.

Exceptions

Thrown if token is null or empty.

Thrown if the length of token is greater than MaximumTokenSizeInBytes.

Remarks

If the token is in JWE Compact Serialization format, only the protected header will be deserialized.

This method is unable to decrypt the payload. Use ValidateToken(String, TokenValidationParameters)to obtain the payload.

The token is NOT validated and no security decisions should be made about the contents. Use ValidateToken(String, TokenValidationParameters) or ValidateTokenAsync(String, TokenValidationParameters) to ensure the token is acceptable.

Applies to