Programatically establish a user session

6 Comentarios

  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Sam,

    I think you're spot on for what the issue is. Would you be able to try calling the '/api/v2/users/me' endpoint after completing the jwt process? Can you confirm that it's not showing 'anonomyous'? I just want to rule out any JWT issues. In the meantime I will be doing some testing to figure out what the best method to accomplish this is. 
    Thanks for your patience!
  • Sam Shiles

    HI Eric Nelson, many thanks for getting back to me. I can confirm that the response frm '/api/v2/users/me' is not showing as 'anonomyous', the response I get is:


        "user": {
          "id": <REDACTED>,
          "url": "<REDACTED>/api/v2/users/392459029837.json",
            "name": "Sam Shiles",
          "email": "sam@<REDACTED>",
            "created_at": "2022-02-17T21:55:21Z",
            "updated_at": "2022-05-18T07:22:48Z",
            "time_zone": "Europe/London",
            "iana_time_zone": "Europe/London",
            "phone": null,
            "shared_phone_number": null,
            "photo": null,
            "locale_id": 1,
            "locale": "en-US",
          "organization_id": <REDACTED>,
            "role": "admin",
            "verified": true,
          "authenticity_token": "<REDACTED>",
            "external_id": null,
            "tags": [],
            "alias": null,
            "active": true,
            "shared": false,
            "shared_agent": false,
            "last_login_at": "2022-05-18T07:22:48Z",
            "two_factor_auth_enabled": null,
            "signature": null,
            "details": null,
            "notes": null,
            "role_type": 4,
            "custom_role_id": 4434476582801,
            "moderator": true,
            "ticket_restriction": null,
            "only_private_comments": false,
            "restricted_agent": false,
            "suspended": false,
            "default_group_id": 4434476625553,
            "report_csv": true,
            "user_fields": {}
  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Sam,

    Mind if I pull this into a ticket so you can share some code snippets? 
  • Sam Shiles

    Sure thing!

  • Eric Nelson
    Zendesk Developer Advocacy
    Thanks Sam! I've created a ticket on your behalf. Look forward to working with you via that.
  • Tamir Bashkin

    Although ours was a completely different use case, we were also stuck at the same point - needing to automatically log in a user to Zendesk and grab their “_zendesk_shared_session” cookie.


    We wanted to track changes to ticket subject lines if the subjects were changed by the end-user via email. Zendesk only makes original emails retrievable from the interface (via “Show original” button) so we couldn’t utilize any API calls to get this information.


    We managed to retrieve the original emails programmatically (using Make/Integromat) by sending a GET request to the URL of the “Show original” button.


    While this worked fine with an active cookie, we needed a way to update the cookie automatically instead of manually retrieving it from our browsers every few days.


    Long story short - Apify was able to solve this problem for us by creating an actor that does the following:


    1. Access the “SSO bypass” form and trigger sending an email with an access token

    URL: https://{subdomain}

    The actor only needed the following input to run:

    1. Use the access link from the email to log in to Zendesk and get the cookie

    To fully automate this workflow, we used Make to run the Apify actor, as well as retrieve and parse the received access tokens and cookies. Final result:


    Hope this helps!



Iniciar sesión para dejar un comentario.

Tecnología de Zendesk