Encoding and sending ZAF JWTs



投稿日時:2022年12月12日

Hey, I have a technical question and don’t see much support for it online so wanted to reach out here for finding more answers.https://developer.zendesk.com/documentation/apps/getting-started/making-api-requests-from-a-zendesk-app/#encoding-and-sending-zaf-jwtsI have been following the above guide for authenticating the Zendesk Side App to the Backend Server (Rails) using JWT. When I was testing this out in my local, I’m unable to get that working since the secure options need to be set to true on the docs but that doesn’t work well in our locally, and in one of the supported articles, I have read that this needs to be turned to false.

When the secure config set to false and the authorization header jwt.token doesn’t pass in the encoded header to the backend. It’s just passing that string directly. Any thoughts on how to get that up and working?

Request:

const options = {
  url: "http://127.0.0.1:3042/api/v1/zendesk",
  type: "POST",
  headers: {
    Authorization: "Bearer {{jwt.token}}",
  },
  jwt: {
    algorithm: "HS256",
    secret_key: "{{setting.shared_secret}}",
    expiry: 3600,
    claims: {
      jti: "8883362531196.326",
      iss: "127.0.0.1:3042",
    },
  },
  accepts: "application/json",
  cors: true,
  secure: false,
};

client.request(options).then((response) => {
  console.log(response);
});

0

6

6件のコメント

Hello Tipene,

We have set the secure=true flag and it worked! Thank you for your time.

 

0


Hey Simos,
 
Thanks for clarifying that for me.
 
I'm going to pull this in to a ticket so we can take a look at your code. You should see an email coming through from me shortly.
 
Thanks!
 
Tipene

0


Hello Tipene

 

We're seeing this behaviour while we uploading the app on the Zendesk instance as a private app and not trying it through ZCLI server.

Thank you

0


Hey Simos Kamilieris,

If you're seeing this behavior when testing your app locally using ZCLI, the likely cause of the issue will be the limitations around secure settings and the ZCLI server. You can read more about that here. As noted in the docs, you'll need to upload the app directly for the proxy to insert the secure values correctly.

If you're seeing this behavior on apps that have been uploaded to your Zendesk instance, let me know and I can take a look in more detail.

Thanks!

Tipene

1


hello i have also the same question

0


Hey Suryateja,
 
Just checking in to see if you were able to find a solution to your issue? If not, let me know and I can look in to it for you.
 
Thanks!
 
Tipene

0


サインインしてコメントを残してください。

お探しのものが見つかりませんか?

新規投稿