Skip to content

Instantly share code, notes, and snippets.

@jfcote87
Created February 6, 2015 06:03
Show Gist options
  • Select an option

  • Save jfcote87/f61a74b92192a28c0ed2 to your computer and use it in GitHub Desktop.

Select an option

Save jfcote87/f61a74b92192a28c0ed2 to your computer and use it in GitHub Desktop.
oauth2: User Password Authorization
func (c *Config) Authorize(ctx Context, username, password string) (TokenSource, error) {
tk, err := return retrieveToken(ctx, c, url.Values{
"grant_type": {"password"},
"username": {username},
"password": {password},
"scope": condVal(strings.Join(c.Scopes, " ")),
})
if err != nil {
return nil, err
}
ts := c.TokenSource(ctx, tk)
return ts, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment