Skip to content

Ad hoc Go client package for Google Play Services OAuth.

License

Notifications You must be signed in to change notification settings

kjedeligmann/gpsoauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ad hoc Go client package for Google Play Services OAuth

Inspired by the gpsoauth Python library.

Usage

For now, you can use this package to fetch an access token for authentication (that's my usecase) as follows:

package main

import (
	"fmt"
	"log"

	"github.com/kjedeligmann/gpsoauth"
)

func main() {
	var email, masterToken, gaid, scopes string // you should have credentials and API scopes

	resp, err := gpsoauth.PerformOAuthWithDefaults(
		email,
		masterToken,
		gaid, // Google Advertising ID, or Android ID
		scopes,
		"com.google.android.keep")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(resp["Auth"]) // access token
}

This is similar to this piece of code.

You can also fetch a master token for your account:

	resp, err := gpsoauth.ExchangeTokenWithDefaults(email, webToken, gaid)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(resp["Token"]) // master token

You can learn more about obtaining webToken here. Overview of Google Play Services OAuth flow can be found here.

About

Ad hoc Go client package for Google Play Services OAuth.

Resources

License

Stars

Watchers

Forks

Languages