Recent searches


No recent searches

Anatomy of a JWT request



Edited Jan 16, 2025


9

6

6 comments

Sorry to bring this up again, I have an issue when trying to match the user_fields in PHP. The User does not get updated / created with the custom fields filled. 


$jwtToken = \Firebase\JWT\JWT::encode([
'name' => $principal->getName(),
'email' => $principal->getEmail(),
'external_id' => $principal->getId(),
'iat' => (int) $now->format("U"),
'exp' => (int) $expire->format("U"),
'user_fields' => json_encode(["user_id" => $principal->getId(), 'newtest' => 'should have some value'])
], 'secret', 'HS256');

I'm not sure if I have misinterpreted this part. But when using the web widget, this seems like the only plausible way to create/update a user without calling the API. 

0


image avatar

Remi

Zendesk Customer Care

Hi Daniel Korsgaard,

Thank you for your post here, I hope you are doing well today !

I understand you want to use your JWT within the Web Widget, right? 

If the idea is to pass some Values to the User Fields, you need to ensure that :

  • You can pass only "custom user fields", therefore, they need to be already existing and saved within your instance.
  • You need to respect the right format for this value, according to the type of field you want to use. (Checkboxes use boolean values, date codes follow the example above, and drop-downs accept the name of the option. Text fields accept strings.)
  • This must be passed as a JSON object.
  • Remember that you cannot assign the (Internal/Zendesk) user ID yourself, this will be automatically assigned when the user is created.

You may find a list of examples for JWT attributes here.

Otherwise, if the idea is to auth a user within the Web Widget, then you might need to follow this doc : Is it possible to set up SSO auth within the Web Widget and the Chat Widget?


If the issue persist, let us know, and we can create a ticket with the support for you (or else you can create a ticket directly) and we will look into this as well as checking in our logs what we received in our backend through your Auth request.

Hope this helps! Feel free to let us know if further assistance is required on your side.

Have a great rest of your day,

Best regards.

0


Where is the option to 'Allow update of external IDs'? 

Edit: Found it! domain.zendesk.com/admin/account/security/sso

My understanding is that this will use the external ID instead of the email if enabled. However, the request must have an external ID in order for this to work. Will it default to email if external ID is missing?

Thanks!

0


Hi Jon –

There's a note in the documentation above:

"If the option 'Allow update of external IDs' is enabled in Zendesk, we'll continue to key off the email even if an external ID is received. If the email and external ID differ, we'll change the ID."

Does that help?

-1


Hi, I have a question about the use of the locale_id, because for me is not working my payload looks like this:

the locale_id 1 is referent to the English language, but when I try to open zendesk it's showing on Spanish
Thanks.

0


Is all of this equally applicable to Mobile SDK integration, as well as SSO integration?

 

Is it the case that only the “optional properties” listed above are supported? The Mobile SDK integration tutorial indicates that “everything else is optional,” and we'd like to stuff additional custom properties at the payload's top level.

0


Please sign in to leave a comment.