Inspired by the gpsoauth Python library.
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.