These steps cover writing and running your application:
- From your terminal/console application, create and navigate to the chapter6/client directory.
- Copy tests from https://github.com/agtorre/go-cookbook/tree/master/chapter6/oauthstore or use this as an exercise to write some of your own code.
- Create a file called config.go with the following content:
package oauthstore import ( "context" "net/http" "golang.org/x/oauth2" ) // Config wraps the default oauth2.Config // and adds our storage type Config struct { *oauth2.Config Storage } // Exchange stores a token after retrieval func (c *Config) Exchange(ctx context.Context, code string) (*oauth2.Token, error) { token, err := c.Config.Exchange(ctx, code) if err != nil {