Last active
October 11, 2023 15:47
-
-
Save Gattermeier/71b8de83d2043a81f7b98e439ed934c1 to your computer and use it in GitHub Desktop.
go implementation to get access token for oak from scoop auth
This file contains 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
// https://github.com/nytimes/nodetools/blob/main/scoop/auth.js#L15C1-L37C3 | |
func getToken() (string, error) { | |
conf := &oauth2.Config{ | |
ClientID: "interactive", | |
Endpoint: oauth2.Endpoint{ | |
TokenURL: tokenURL, | |
AuthURL: authURL, | |
}, | |
} | |
token, err := conf.PasswordCredentialsToken(context.Background(), username, password) | |
if err != nil { | |
return "", err | |
} | |
return token.AccessToken, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment