How can i use SteamAPI with Django?

Question:

How can this be possible? I am trying to add steam authentication button in my website and get general information: username, steam id.

something like this as example:

views.py:

# Example
from django.shortcuts import render
from django.http return HttpResponse

def index(response):
    ...
    return render('link.html', response) # link html contains <a> tag which should lead to steam authentication.
    ...

def afterauth(request):
    if auth = SteamAuth.wasSucessful:
        return HttpResponse("Username: " + SteamAuth.Username() + "SteamID: " + SteamAuth.ID())

I have gotten the API key, but i couldn’t find any documentation regarding how to use it with Django.

Is there any way i can achieve this? Are there any tutorial’s or documentation where i can use Steam API with Django?

Asked By: ShellRox

||

Answers:

You can use the python-social-auth package that has native support for both django and the steam API:

Multiple frameworks are supported:

  • Django
  • Flask
  • Pyramid
  • Webpy
  • Tornado

Auth providers

  • Soundcloud OAuth2
  • Stackoverflow OAuth2
  • Steam OpenId
  • Stocktwits OAuth2
  • Strava OAuth2
  • Stripe OAuth2
Answered By: Anonymous

For Python3 and Django 2.x, django-allauth can be used. They support pretty much every provider available and I have used it multiple times for Steam authentication with very little effort

Answered By: Santhosh Kumar
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.