Skip to main content

pySteamSignIn

A lightweight Python 3 helper class for getting OpenID 2.0 Steam sign-in up and running quickly.

There aren’t really any Steam-specific OpenID 2.0 sign-in libraries that provide clear documentation or insight into how the flow actually works. Most guidance instead points people at generic OpenID libraries, which are often overkill for Steam and fairly bloated in practice.

As a result of this pySteamSignIn is designed to let you plug in Steam Auth as quick as possible and let you start returning results immediately.

Installation

pySteamSignIn is now available on pip!

pip install steamsignin

Lets quickly get authentication rolling

The power behind this is it provides the entire auth process over two (or three, if you're using bottlepy / Flask / FastAPI) functions. The first function is ConstructURL, which takes a string and returns a string

The string to pass is whatever page the user is going to be sent back to as a result of logging in with Steam.

from pysteamsignin.steamsignin import SteamSignIn

steamLogin = SteamSignIn()
encodedData = steamLogin.ConstructURL('https://0.0.0.0:8080/processlogin'))
ForwardClientToSteamPage(encodedData) #Not a real function, but the next action you'd take
...

At this point you forward the client on with a post request to https://steamcommunity.com/openid/login and you'll get thrown a bunch of stuff back.

The important thing here is that you get thet GET returned data put into a dictionary to then pass on to ValidateResults

# Some function where the data has been passed in a dictionary no less
steamLogin = SteamSignIn()
returnedSteamID = steamLogin.ValidateResults(dictionaryGoesHere)
# Perform checks to see if you actually have something that isn't false
...

And that's the general gist of it! At this point the user has been validated by Steam's own servers so the Steam64ID returned is one that can be trusted.

If you use Bottlepy, Flask or FastAPI...

An additional helper function has been provided under the guise of RedirectUser. This will just relay the user on your behalf to the Steam site, as such

steamLogin = SteamSignIn()
steamLogin.RedirectUser(steamLogin.ConstructURL('https://0.0.0.0:8080/processlogin'))
# In the case of Flask / FastAPI, return the above RedirectUser call instead.
...

Dependencies

The core of pySteamSignIn uses only the Python standard library and does not depend on external HTTP clients such as requests. Optional helper functions are provided for common web frameworks (Bottle, Flask, FastAPI) and are only enabled if those frameworks are already installed.

Finally

Hopefully this helps someone get OpenID 2.0 Steam sign-in and Python working together a bit more smoothly. There's a few solutions for Flask and Django (which are basically glorified wrappers for python-openid) but both of them can still result in a fair few steps.

This is based on OpenID 2.0 and not OpenID Connect / OAuth 2.

If you require a Go version of this library, this is available here.

Metadata

Release files for steamsignin 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for steamsignin 1.1.3
File Size Uploaded
steamsignin-1.1.3.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for steamsignin 1.1.3
File Interpreter ABI Platform
steamsignin-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / steamsignin-1.1.3.tar.gz

Download URL steamsignin-1.1.3.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1bf90b7ad63ec194bf9068eca4ae4431a9065f7ef233bd91824e26c7b61c2c2a
BLAKE2b-256 checksum
How to use checksums
4011d858bebcc67d80d72a89142c26a731606f060cccf52479234fd7b46bec9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.2

Release files / steamsignin-1.1.3-py3-none-any.whl

Download URL steamsignin-1.1.3-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15e6a652f4697a01d2911d5f64b2e78480bf1d19d379a19db537b5bbbd8e38f6
BLAKE2b-256 checksum
How to use checksums
2209de169e686fab926e4ec2dba15d8cbb7912928b7f161406d2831ecc8aa452
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.2

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page