Skip to content

Instantly share code, notes, and snippets.

@abheist
Created August 2, 2016 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abheist/7d1fbea75605afd940a2ca196e21fcf6 to your computer and use it in GitHub Desktop.
Save abheist/7d1fbea75605afd940a2ca196e21fcf6 to your computer and use it in GitHub Desktop.
Freshdesk Single Sign On (SSO) in python
from datetime import datetime
import hmac
def ticket_login():
digest_maker = hmac.new('---------SECRET SHARED KEY---------')
url = "http://portalname.freshdesk.com/login/sso?name={0}&email={1}&timestamp={2}&hash={3}"
digest_maker.update('abhishek')
digest_maker.update('abhishek@abhishek.com')
td = datetime.utcnow()-datetime(1970,1,1)
ts = str(int(td.total_seconds()))
digest_maker.update(ts)
digest = digest_maker.hexdigest()
return url.format('abhishek','abhishek@abhishek.com',ts,digest)
print ticket_login()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment