Trying to get access_token, but 400 or 403 are returned.

When access_token is requested, it returns a 400 error for application/json and a 403 error for application/x-www-form-urlencoded.

I want to get the user’s access_token in oAuth format and join them to an already opened meeting room.

The name of the app is LSKApp, and it is currently under review.

Please help me to move on to the next level.

Below is the source code.

==========================================

var oAuth = new oAuthParameter();
oAuth.grant_type = “authorization_code”;
oAuth.code = code;
oAuth.redirect_uri = $"{Request.Scheme}://{Request.Host}/Zoom/Auth/Token";

try
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create(“https://zoom.us/oauth/token”);
httpWebRequest.ContentType = “application/json”;
httpWebRequest.Method = “POST”;

var plainTextBytes = System.Text.Encoding.UTF8.GetBytes($"{this.siteConfig.Zoom.ClientID}:{this.siteConfig.Zoom.Secret}");
string crypto = Convert.ToBase64String(plainTextBytes);
httpWebRequest.Headers.Add("Authorization", $"Basic {crypto}");

using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
	streamWriter.Write(oAuth.Serializer(state));
	streamWriter.Flush();
	streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
	string json_original = streamReader.ReadToEnd();
	if (!string.IsNullOrWhiteSpace(json_original))
	{
		result.Value = code;
		result.Success(1);
		result.Data = JsonConvert.DeserializeObject<ZoomApiAuthCallback>(json_original);
	}
	else
	{
		result.Error("return is Null or Empty.");
	}
}

}
catch (Exception ex)
{
result.Error(ex);
}

@parkheesung Are you able to share the response body when the request fails? That should include more information on the error.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.