auth

package
v0.0.0-...-e2bc47a Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: GPL-3.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	LoginUrl = "https://photos.google.com/login"
	HomeUrl  = "https://photos.google.com/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthFile

type AuthFile struct {
	Cookies []*http.Cookie `json:"cookies"`

	// Parameters used by the requests (user id, etc ...)
	PersistentParameters *PersistentParameters `json:"persistantParameters"`
}

type CookieCredentials

type CookieCredentials struct {
	Client               *http.Client
	PersistentParameters *PersistentParameters
	RuntimeParameters    *RuntimeParameters
}

func NewCookieCredentials

func NewCookieCredentials(cookies []*http.Cookie, parameters *PersistentParameters) *CookieCredentials

func NewCookieCredentialsFromFile

func NewCookieCredentialsFromFile(fileName string) (*CookieCredentials, error)

Restore an CookieCredentials object from a JSON file

func NewCookieCredentialsFromJson

func NewCookieCredentialsFromJson(in io.Reader) (*CookieCredentials, error)

Restore an CookieCredentials object from a JSON

func (*CookieCredentials) CheckCredentials

func (c *CookieCredentials) CheckCredentials() (*CredentialsTestResult, error)

Test the CookieCredentials object to see if the authentication cookies are valid. Note that this method can return false-positive results, but if it return a CredentialsTestResult with false as Valid the cookies are not valid for sure. An eventual as second return parameter try to explain why we can't determine the credentials validity

func (*CookieCredentials) Serialize

func (c *CookieCredentials) Serialize(out io.Writer) error

Serialize the CookieCredentials object into a JSON object, to be restored in the future using NewCookieCredentialsFromJson

func (*CookieCredentials) SerializeToFile

func (c *CookieCredentials) SerializeToFile(fileName string) error

Serialize the CookieCredentials object into a JSON file, to be restored in the future using NewCookieCredentialsFromJsonFile

type CredentialsTestResult

type CredentialsTestResult struct {
	// False if the cookies are not valid anymore
	Valid bool

	// Reason to explain a negative Valid field value
	Reason string
}

Result of a credentials test

type PersistentParameters

type PersistentParameters struct {
	UserId string `json:"userId"`
}

type RuntimeParameters

type RuntimeParameters struct {
	AtToken string
}

Jump to

Keyboard shortcuts

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