Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

paceline/goauth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goauth2

Fork of the goauth2 project, allowing the library to be used in Google App Engine hosted projects (as I do for autosite-go)

Install

Just check out or download the source code from its GitHub repository and copy it to your project's root directory. Import in your GO code like you would any other library:

import (
    "appengine"
    "appengine/urlfetch"
    "github.com/paceline/goauth2/oauth"
    ...
)

Usage

For the most part things work just like shown it the examples here or here. However you need to supply urlfetch.Transport manually, e.g.:

func(w http.ResponseWriter, r *http.Request) {
    c = appengine.NewContext(r)
    config := &oauth.Config{
        ClientId:     *clientId,
        ClientSecret: *clientSecret,
        Scope:        *apiURL,
        AuthURL:      "https://accounts.google.com/o/oauth2/auth",
        TokenURL:     "https://accounts.google.com/o/oauth2/token",
        TokenCache:   oauth.CacheFile(*cachefile),
	}
	transport := &oauth.Transport{Config: config, Transport: &urlfetch.Transport{Context: c}}
	...
}

About

Fork of the goauth2 project, allowing the library to be used in Google App Engine hosted projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages