GithubHelp home page GithubHelp logo

nottrying / pysteamsignin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from teddio/pysteamsignin

0.0 2.0 0.0 6 KB

A small Python 3 class designed to get Steam OpenID 2 sign-in up and running as quick as possible.

Python 100.00%

pysteamsignin's Introduction

pySteamSignIn

A small Python 3 class designed to get Steam OpenID 2 sign-in up and running as quick as possible.

As of this moment in time there's not really any 'decent' Steam Openid libraries that give any proper documentation or insight in terms of how to actually use them. Alongside this they're often fairly bloated and problematic. As a result of this pySteamSignIn is a lite class designed to let you plug in Steam Auth as quick as possible and let you start returning results immediately.

Requires requests to function

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) 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 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 postRequest 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 and you can use it to store information, you can set cookies on the current client and so on.

If you use Bottle...

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'))
...

Finally

Hopefully this helps someone out in terms of getting Steam OpenID and Python working in harmony. 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 1.0. I'm not 100% on the various changes required, but it can possibly be used for an understanding behind the statelent OpenID connect functionality as well.

pysteamsignin's People

Contributors

teddio avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.