Created
August 2, 2016 08:45
-
-
Save abheist/7d1fbea75605afd940a2ca196e21fcf6 to your computer and use it in GitHub Desktop.
Freshdesk Single Sign On (SSO) in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}×tamp={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