Skip to content

TheMrViper/steam_go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

steam_auth

Example

package main

import (
	"net/http"

	"github.com/solovev/steam_go"
)

func loginHandler(w http.ResponseWriter, r *http.Request) {
	opId := steam_auth.NewOpenId(r)
	switch opId.Mode() {
	case "":
		http.Redirect(w, r, opId.AuthUrl(), 301)
	case "cancel":
		w.Write([]byte("Authorization cancelled"))
	default:
		steamId, err := opId.ValidateAndGetId()
		if err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
		//
		//	Do smth with steamId
		//
		w.Write([]byte(steamId))
	}
}

func main() {
	http.HandleFunc("/login", loginHandler)
	http.ListenAndServe(":8080", nil)
}

About

Steam OpenId auth util in Golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%