JwtSecurityTokenHandler.ReadToken Method (String)

Reads a token encoded in JSON Compact serialized format.

Namespace:  System.IdentityModel.Tokens
Assembly:  System.IdentityModel.Tokens.Jwt (in System.IdentityModel.Tokens.Jwt.dll)

Syntax

'Declaration
Public Overridable Function ReadToken ( _
    jwtEncodedString As String _
) As SecurityToken
public virtual SecurityToken ReadToken(
    string jwtEncodedString
)
public:
virtual SecurityToken^ ReadToken(
    String^ jwtEncodedString
)
abstract ReadToken : 
        jwtEncodedString:string -> SecurityToken  
override ReadToken : 
        jwtEncodedString:string -> SecurityToken
public function ReadToken(
    jwtEncodedString : String
) : SecurityToken

Parameters

  • jwtEncodedString
    Type: System.String

    A 'JSON Web Token' (JWT) that has been encoded as a JSON object. May be signed using 'JSON Web Signature' (JWS).

Return Value

Type: System.IdentityModel.Tokens.SecurityToken
Returns SecurityToken.

Remarks

The JWT must be encoded using Base64Url encoding of the UTF-8 representation of the JWT: Header, Payload and Signature.

The contents of the JWT returned are not validated in any way, the token is simply decoded. Use ValidateToken to validate the JWT.

.NET Framework Security

See Also

Reference

JwtSecurityTokenHandler Class

ReadToken Overload

System.IdentityModel.Tokens Namespace