Skip to content

Commit

Permalink
fix access token query
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightczx committed Feb 6, 2024
1 parent 58801d6 commit 782efd9
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,9 @@ public async Task<IActionResult> HandleAuthorizationCallbackAsync([FromQuery(Nam
}

GithubAccessTokenResponse? accessTokenResponse;
using (HttpRequestMessage requestMessage = new(HttpMethod.Post, "https://github.com/login/oauth/access_token"))
string accessTokenQuery = $"client_id={githubOptions.ClientId}&client_secret={githubOptions.ClientSecret}&code={code}";
using (HttpRequestMessage requestMessage = new(HttpMethod.Post, $"https://github.com/login/oauth/access_token?{accessTokenQuery}"))
{
requestMessage.Content = new FormUrlEncodedContent(new Dictionary<string, string>
{
["client_id"] = githubOptions.ClientId,
["client_secret"] = githubOptions.ClientSecret,
["code"] = code,
});
requestMessage.Headers.Accept.Add(new("application/json"));
requestMessage.Headers.Authorization = new("token", code);

Expand Down

0 comments on commit 782efd9

Please sign in to comment.