public static async Task <string> CreateSignedJwtAsync(
            object header, object payload, ISigner signer,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            string encodedHeader  = Encode(header);
            string encodedPayload = Encode(payload);
            var    assertion      = new StringBuilder();

            assertion
            .Append(Encode(header))
            .Append('.')
            .Append(Encode(payload));
            var bytesToSign = Encoding.UTF8.GetBytes(assertion.ToString());
            var signature   = await signer.SignDataAsync(bytesToSign, cancellationToken)
                              .ConfigureAwait(false);

            assertion.Append('.').Append(UrlSafeBase64Encode(signature));
            return(assertion.ToString());
        }