Created
February 6, 2015 06:03
-
-
Save jfcote87/f61a74b92192a28c0ed2 to your computer and use it in GitHub Desktop.
oauth2: User Password Authorization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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