Table of Contents

Class Jwt

Namespace
Vonage
Assembly
Vonage.dll
public class Jwt : ITokenGenerator
Inheritance
Jwt
Implements
Derived
Inherited Members

Methods

CreateToken(string, string, Dictionary<string, object>)

Creates a token from application id and private key.

public static string CreateToken(string appId, string privateKey, Dictionary<string, object> claims = null)

Parameters

appId string

The application id.

privateKey string

The private key.

claims Dictionary<string, object>

The additional claims.

Returns

string

The token.

GenerateToken(string, string, Dictionary<string, object>)

Generates a token.

public Result<string> GenerateToken(string applicationId, string privateKey, Dictionary<string, object> claims = null)

Parameters

applicationId string

The application Id.

privateKey string

The application private key.

claims Dictionary<string, object>

The additional claims.

Returns

Result<string>

The token.

GenerateToken(Credentials, Dictionary<string, object>)

Generates a token.

public Result<string> GenerateToken(Credentials credentials, Dictionary<string, object> claims = null)

Parameters

credentials Credentials

The application credentials.

claims Dictionary<string, object>

The additional claims.

Returns

Result<string>

The token.

VerifySignature(string, string)

Verifies if a token has been generated using the provided private key.

public static bool VerifySignature(string token, string privateKey)

Parameters

token string

The token to verify.

privateKey string

The private key.

Returns

bool

Whether the token signature is valid.