Exemple #1
0
        /// <summary>
        /// Request an access token
        /// </summary>
        public static async Task <AccessTokenModel> RequestAccessToken(string clientId, string clientSecret, string code, string redirectUri, string domainUri = AccessTokenUri)
        {
            if (string.IsNullOrEmpty(domainUri))
            {
                domainUri = AccessTokenUri;
            }

            if (!domainUri.EndsWith("/", StringComparison.Ordinal))
            {
                domainUri += "/";
            }
            domainUri += "login/oauth/access_token";

            var c        = new Client();
            var request  = GitHubRequest.Post <AccessTokenModel>(domainUri, new { client_id = clientId, client_secret = clientSecret, code, redirect_uri = redirectUri });
            var response = await c.ExecuteAsync(request).ConfigureAwait(false);

            return(response.Data);
        }
Exemple #2
0
 public GitHubRequest <AuthorizationModel> Create(List <string> scopes, string note, string noteUrl, string fingerprint)
 {
     return(GitHubRequest.Post <AuthorizationModel>(Uri, new { scopes, note, note_url = noteUrl, fingerprint }));
 }