Hi i am having an issue when trying to get an access token in my program. i am using Visual Studio 2022 and this is the code i have so far:
i have blanked out the client id and client secret just for security purposes.
HttpClient Authclient = _httpClientFactory.CreateClient();
Authclient.BaseAddress = new Uri("https://zoom.us/oauth/authorize?response_type=code&client_id=********&redirect_uri=");
var Authparameters = new Dictionary<string, string> { };
var AuthencodedContent = new FormUrlEncodedContent(Authparameters);
var Authresponse = await Authclient.PostAsync(Authclient.BaseAddress, AuthencodedContent);
HttpResponseMessage? AuthRes = await Authclient!.PostAsync(Authclient.BaseAddress, AuthencodedContent);
var grant_type = "Authorization Code";
var client_id = "*********";
var client_secret = "*******";
var scope = "";
var AccessToken = "";
HttpClient client = _httpClientFactory.CreateClient();
client.BaseAddress = new Uri("https://zoom.us/oauth/token");
var parameters = new Dictionary<string, string> { { "grant_type", grant_type }, { "client_id", client_id }, { "client_secret", client_secret }, { "scope", scope } };
var encodedContent = new FormUrlEncodedContent(parameters);
var response = await client.PostAsync(client.BaseAddress, encodedContent);
HttpResponseMessage? Res = await client!.PostAsync(client.BaseAddress, encodedContent);
i am getting an error with the final final as i am getting an error 400 Bad request.
im not sure whats wrong as i have tested all this in postman and managed to get it to work so not sure ehats causing the issue.
any help would be appreciated.
Thanks