Pesquisas recentes
Sem pesquisas recentes

jonatan bouillon
Entrou em 24 de jun. de 2022
·
Última atividade em 24 de jun. de 2022
Seguindo
0
Seguidores
0
Atividade total
2
Votos
0
Assinatura
1
VISÃO GERAL DA ATIVIDADE
MEDALHAS
ARTIGOS
PUBLICAÇÕES
COMENTÁRIOS NA COMUNIDADE
COMENTÁRIOS EM ARTIGOS
VISÃO GERAL DA ATIVIDADE
Atividade mais recente por jonatan bouillon
jonatan bouillon criou uma publicação,
I want to authenticate the user with zendesk so he will not have to type is name or anything. So I had the widget to my web site and after login I create a JWT and log the user to zendesk using the code bellow.
But, when I send the JWT I receive an error that my JWT is invalid but I have followed the format defined in the documentation.
Enabling authenticated visitors in the Chat widget – Zendesk help
- https://api.smooch.io/sdk/v2/apps/62a3555aac1ecd00f2421c67/login
-
{error: {code: "invalid_auth", description: "Invalid JWT"}}
- error: {code: "invalid_auth", description: "Invalid JWT"}
- code: "invalid_auth"
- description: "Invalid JWT"
I use c# backend to generate a JWT with the JWT.Net nuget package.
I use the plain secret genereted from zendesk. Do I need to base64 the secret before creating the JWT or i should use it as it is?
public class JwtTokenService
{
public string Secret { get; }
public JwtTokenService(string secret)
{
Secret = secret;
}
public string Create()
{
var headers = new Dictionary {
{ "typ", "JWT" },
{ "kid", "app_62b5e0ffca5a3800f0225c53" }
};
var payload = new Dictionary {
{ "external_id", "12316542344" },
{ "email", "janes@soap.com" },
{ "exp", "12345678" },
{ "name", "Jane Soaps" },
{ "scope", "user" }
};
var alg = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(alg, serializer, urlEncoder);
return encoder.Encode(headers, payload, Secret);
}
}
In my web page I use the web widget sniped from copied from zendesk and I call the login.
Publicado 24 de jun. de 2022 · jonatan bouillon
2
Seguidores
9
Votos
13
Comentários