User authentication from C# | Community
Skip to main content

User authentication from C#

  • June 16, 2023
  • 4 replies
  • 0 views

Bala13

Hi,

Can I authenticate users from the backend(C#) without using the frontend like javascript? If yes, what endpoint should I be using to authenticate users? Thank you for your help.

4 replies

Greg29
  • June 16, 2023

Hi Bala! Could you provide some more context for this? Which of our platform tools are you using? Where will this be implemented? Which users are you authenticating? Do you already have SSO in place?


Bala13
  • Author
  • June 16, 2023

Hi Greg! 

We have a requirement to authenticate users in Zendesk as soon as they log into our website. Right now when they login, they can see the chat widget and they can post their questions by entering their email address. We would like to authenticate users automatically upon logging into the website so they could bypass entering their email address for messaging. 

I went to the admin => account => end user authentication => messaging and create a secret key. I saw this note there 

"Use these signing keys to authenticate end users with a trusted JSON Web Token (JWT) and give them access to their message history across multiple devices."

In the backend(C#), I have created a jwt token 
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCAiOiJ0ZXN0YWNjdDYxN0BzdXp5LmNvbSIsIm5hbWUiOiJUZXN0IiwiZXh0ZXJuYWxfaWQiOiJlOWQ1ODNlOC05NmUyLTQwNjEtODVlYy1mNzAwMTFkZmExZmIiLCJleHAiOiIyMDIzLTA2LTE3VDEzOjIzOjA5LjUyODg0MzktMDU6MDAiLCJqdGkiOiJiODEzYTFlNy0wN2JiLTQ4NzMtYWIxYy1kMmYwNDRhNWFmNWIiLCJpYXQiOjE2ODY5Mzk3ODl9.Ky1ttE_01hCLQorT2fpiJ-JnJqv6c6eSoLUMnxBqpPg
 
I have the jwt token now. But not sure what API I should be calling to authenticate users from the backend. Please let me know if you need further information. Thank you again for your help.

 


Greg29
  • June 16, 2023
Thanks for that clarification! You'll want to use this method to pass that to Zendesk, which we outline in step 3 of the process here. Let us know if you have any other questions!

Bala13
  • Author
  • June 16, 2023

Hi Greg,

The link provided above takes me to this method. I don't think this is a backend method. It seems like a frontend script. I was looking for a way to pass the jwt token from backend to Zendesk directly. Can you please let me know if there are any ways? Thank you for your help.

zE("messenger", "loginUser", function (callback) {  callback("new-jwt-for-user")})