Example Web SDK Integration
Django Implementation of HumanID SSO

Developer Console

Acquire CLIENT-ID, CLIENT-SECRET, and set-up redirect URLs on the App Details page by registering your app through https://developers.human-id.org/home/.

WebLoginUrl API Call

Create a view function that will perform a POST API request and render HTML:
1
#YOUR_APP/views.py
2
def homepage(request):
3
headers = {'client-id':'CLIENT_ID','client-secret':'CLIENT_SECRET'}
4
response=requests.post('https://core.human-id.org/v0.0.3/server/users/web-login',headers=headers)
5
data=response.json()
6
return render(request,'trial/homepage.html',
7
{
8
'data':data
9
})
Copied!
Create a HTML page:
1
<!YOUR_APP/templates/homepage.html>
2
{%block content%}
3
<div>
4
<p>{{data}}</p>
5
<p><a href={{data.data.webLoginUrl}}>{% include 'anonymous-login.svg.html'%}</a></p>
6
</div>
7
{%endblock%}
Copied!

Callback URL

After a user successfully logs in through humanID. The user will be redirected to the URL specified in the developer console on the App Details page.
Create a function that will take the exchange token in that URL and make another API request to acquire a unique User ID.
1
#YOUR_APP/views.py
2
def callback(request):
3
headers = {'client-id':'CLIENT_ID','client-secret':'CLIENT_SECRET'}
4
token = request.GET.get('et')
5
response= requests.post('https://core.human-id.org/v0.0.3/server/users/exchange',headers= headers,data={'exchangeToken':token})
6
data=response.json()
7
return render(request,'trial/callback.html',
8
{
9
'data':data
10
})
11
Copied!