Created
January 22, 2014 19:57
-
-
Save nigel-sampson/8566230 to your computer and use it in GitHub Desktop.
Octokit OAuth Token Ruest
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
var gitHubClient = new GitHubClient(new ProductHeaderValue("Test App", "0.0.0.1")) | |
{ | |
Credentials = Credentials.Anonymous | |
}; | |
var content = new FormUrlEncodedContent(new Dictionary<string, string> | |
{ | |
{"client_id", ClientId }, | |
{"client_secret", ClientSecret }, | |
{"code", responseParameters["code"] }, | |
{"state", state } | |
}); | |
var response = await gitHubClient.Connection.PostAsync<AccessToken>(new Uri("https://github.com/login/oauth/access_token", UriKind.Absolute), content, "application/json", "application/x-www-form-urlencoded"); | |
return new Credentials(response.BodyAsObject.Token); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment