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)
}
forked from solovev/steam_go
-
Notifications
You must be signed in to change notification settings - Fork 0
TheMrViper/steam_go
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Steam OpenId auth util in Golang
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Go 100.0%