gog_auth

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 12 Imported by: 1

README

gog_auth

Implementation of the GOG.com website (as in "not Galaxy") authentication flow, including 2FA. Captcha is detected, not supported.

GOG.com authentication details

Exported functions:

Login

Implements authentication flow for a given username, password and a callback to get second factor auth token (you'll get this in mail on login attempt if you have it set up)

LoggedIn

Returns whether a user is logged in.

Persistent authentication

You'll need to pass http.Client reference with a cookieJar that would hold GOG.com authentication cookies. Client implementations might differ, however general flow should look something like the following:

  • Load persistent cookies
  • Create a http.CookieJar and add those cookies
  • Create a http.Client with that cookieJar
  • Check if the gog_auth.LoggedIn is true
    • If it is: interact with AccountProducts, Wishlist, etc. types that require authentication
    • If it isn't: Login with a username, password, optional 2FA
  • At the end of the session - save persistent cookies from the cookieJar

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggedIn

func LoggedIn(client *http.Client) (bool, error)

func Login

func Login(client *http.Client, username, password string, requestText func(string) string) error

Login to GOG.com for account formData queries using username and password

Overall flow is: - Get auth token from the page (this would check for reCaptcha as well) - Post username, password and token for check - Check for presence of second step auth token - (Optional) Post 4 digit second step auth code

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL