using (var client = new HttpClient())
{
var request = new FormUrlEncodedContent(new Dictionary<string, string>
{
{ "client_id", consumerKey},
{ "client_secret", consumerSecret},
{ "redirect_uri", "https://localhost:44324/"},
{ "response_type", "token"}
});
request.Headers.Add("X-PrettyPrint", "1");
var response = client.PostAsync(loginURL, request).Result;
jsonResponse = response.Content.ReadAsStringAsync().Result;
}
The above code is redirecting me to salesforce login page and after entering the credentials it redirects to the callback url with the access token value in it.
https://localhost:44324/#access_token=00D5g000004EZsd%21ARIAQIknKTgasR0GjL1sxS.AuzMhTr.QNh2MU.qE9yPVCgvrPOKO9wmmU98YS3zFDZ0i7xr9Q9OsiN6rqNVB7k_wYg80PLBt&instance_url=https%3A%2F%2Faccenture854-dev-ed.my.salesforce.com&id=https%3A%2F%2Flogin.salesforce.com%2Fid%2F00D5g000004EZsdEAG%2F0055g000002qAkZAAU&issued_at=1613988715969&signature=E9OwlwTp%2FftrP%2FWN0xocr5hqLUE1Ra5oO6GZ6YVgaPE%3D&scope=full&token_type=Bearer
Now is there a way I can get this access token from above url in my asp.net code?