Building a dedicated JWT endpoint for the Support SDK | The place for Zendesk users to come together and share
Skip to main content

20 replies

March 17, 2021

It's a shame there is no "Test it now" button in the Mobile SDK App Setup page. One where I could provide "unique_id" and get some kind of feedback whether the endpoint is reachable, returns correct JWT (content-wise and signature-wise).

Would it be possible to have this? It would definitely help decrease number of support tickets on your side.

March 17, 2021

Is there a way to avoid email in the jwt payload as I need to use phone as primary identity ?

March 17, 2021

I am receiving request from the zendesk on my lambda service with user_token that is sent from the mobile app. I am validating the necessary items and sending back the jwt after signing it with the secret. My response looks exactly the same with the curl example given above.

But on mobile it gives error code 400, body is null. What could be the issue. 

March 17, 2021

Nope, field must be present and non-empty. However, in case of JWT authentication, you can provide also external_id which will be used for customer matching instad of email. The primary identity is then in your hands.

March 17, 2021

Hello,
We are implementing a dedicated endpoint for use with the Zendesk SDK in order to authenticate users through a JWT. Our implementation in our backend works correctly, it returns the expected response. However, when we use the Zendesk SDK, there are no traces of a request being made from Zendesk to our servers, even though we have configured everything correctly, as instructed in this link: https://develop.zendesk.com/hc/en-us/articles/360001075248-Building-a-dedicated-JWT-endpoint-for-the-Support-SDK.

What do you think this might be?

Thank you

March 17, 2021

Usually the issue is with the JWT you return. I think I managed to get all the problems that might occur:
- undefined custom field
- inconsistent identity (different id with same email already existed in Zendesk)
- incorrect signature
- incorrect language code

Sadly you can get the explanation from Zendesk support only, which has 2-5 days reaction time.

March 17, 2021

Two things - you have to enable JWT authentication in Zendesk setup and make sure you initialize Zendesk SDK properly (you need to use the identity which expects customer identifier/token)

March 17, 2021

Hey @Ladislav Lenčucha, thank you for the answer.

We enabled the JWT authentication in Zendesk according to the documentation. Related to the SDK, we are using the following code (iOS):

Zendesk.initialize(appId: Bundle.main.zendeskAppID,
clientId: Bundle.main.zendeskClientID,
zendeskUrl: Bundle.main.zendeskURL)
CommonTheme.currentTheme.primaryColor = .SecondaryBemon400
// Authenticated session
if let token = try? Session.Authentication.getPubID() {
logger?.log("PubID: \(token)", level: .debug)
if let instance = Zendesk.instance {
let identity = Identity.createJwt(token: token)
instance.setIdentity(identity)
logger?.log("Zendesk itentity setup correctly", level: .info)
} else {
logger?.log("No Zendesk Instance was found. Zendesk session is not authenticated", level: .error)
}
} else { // Unauthenticated session
let ident = Identity.createAnonymous()
Zendesk.instance?.setIdentity(ident)
logger?.log("Zendesk itentity with anonymous setup", level: .info)
}
Support.initialize(withZendesk: Zendesk.instance)
Chat.initialize(accountKey: "dummykey")
AnswerBot.initialize(withZendesk: Zendesk.instance,
support: Support.instance!)

We don´t know what could be failing.

Thanks again!

March 17, 2021

i have initialised the zendesk SDK on Android , and tried to get Identity with the help of following code:-

Identity identity = new JwtIdentity("unique_id");
Zendesk.INSTANCE.setIdentity(identity);

"unique_id" is the unique identifier of the user. 

My JWT not getting any hit from Zendesk Server.

 

I am getting following logs :-

D/OkHttp: <-- 401 https://{companyname}.zendesk.com/access/sdk/jwt (2896ms, 37-byte body)

D/GsonSerializer: Unable to deserialize the provided object into AccessToken

W/ZendeskIdentityManager: There is no stored access token, have you initialised an identity and requested an access token?

 

Can anybody help us with this issue ?

 

Note: We have replaced the actual name with {companyname} for the purpose of privacy

Fernando31
September 6, 2021
We are implementing Zendesk chat and support in our mobile app and we want to authenticate the mobile users via JWT
 
But we coudn´t see any calls to the jwt endpoint from mobile apps.
Any help?