FreshDesk SSO using JWT with C#

Paul Wheeler
1 min readMay 20, 2021

FreshDesk has recently moved to a newer SSO system through FreshWorks and I couldn’t find a decent example online in C#. We are allowing users to access FreshDesk by clicking on a support link within our web application. It took a bit of time to figure out how to get this working with the new system so I thought I would post an example of how I got it working here to maybe help someone else. (This is their relevant support document:

When a user in our application clicks on the support link, we initially send them to this URL (replace {subdomain} with whatever subdomain is configured for your company : https://{subdomain}

If the user is not already logged in, and you only have JWT setup as the SSO option, they will be redirected back to your site at whatever URL you configured. You will need to retrieve the “state” and “nonce” values from the query string which should look something like this (from their docs):

You can then generate the token using the code below, and redirect the user to the URL and they will be automatically signed in. I am using the JWT Nuget package since has a nice simple interface to do what we need (