I have trouble with OAuth 2 authentication my app in .Net. I'm creating an integration between BigCommerce and SmartPablo. Single click app authorization and authentication occurs via OAuth2 authorization code grant.
Part of my Code:
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://login.bigcommerce.com/oauth2/token");
Dictionary<string, string> body = new Dictionary<string, string>()
{
{"client_id", "clientId"},
{"client_secret", "clientSecret"},
{"redirect_uri", baseUrl + "/auth/install"},
{"grant_type", "authorization_code"},
{"code", query["code"]},
{"scope", query["scope"]},
{"context", query["context"]}
};
request.Content = new FormUrlEncodedContent(body);
HttpResponseMessage response = await _clientFactory.CreateClient().SendAsync(request);
Can someone please help me?