Transfer account ownership resulted in broken Rest API for server-to-server Oauth

Hi!

We recently switched ownership for a server-to-server Oath app we created for client my account to the owner of the client’s Zoom domain. This Oauth app was meant for usage of the Webinars/Meetings Rest API to make registrants at our client’s website possible directly into Zoom.

After the owner switch, our Bearer authentication in our Rest API in C# stopped working and now we only receive 400 request from the server.

Is there something we are missing? The Oauth app did not seem to have change credentials for the Account Id, Client secret and Client Id.

Here is how we manage the call in our C# application:

public async Task GetZoomAccessToken(string zoomUrl = “”, string clientId = “”, string clientSecret = “”, string accountId = “”)
{
zoomUrl = string.IsNullOrWhiteSpace(zoomUrl) ? _appSettings.ZoomBaseUrl : zoomUrl;
clientId = string.IsNullOrWhiteSpace(clientId) ? _appSettings.ZoomClientId : clientId;
clientSecret = string.IsNullOrWhiteSpace(clientSecret) ? _appSettings.ZoomClientSecret : clientSecret;
accountId = string.IsNullOrWhiteSpace(accountId) ? _appSettings.ZoomAccountId : accountId;

    var zoomOuathUrl = $"{zoomUrl}/oauth/token";

    var base64Auth = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{clientId}:{clientSecret}"));

    using (HttpClient client = new())
    {
        client.DefaultRequestHeaders.Add("Host", "zoom.us");
        client.DefaultRequestHeaders.Add("Authorization", $"Basic {base64Auth}");

        var content = new FormUrlEncodedContent(new Dictionary<string, string>
        {
            { "grant_type", "account_credentials" },
            { "account_id", accountId }
        });

        HttpResponseMessage response = await client.PostAsync(zoomOuathUrl, content);

        if (response.IsSuccessStatusCode)
        {
            var responseContent = await response.Content.ReadAsStringAsync();
            var tokenResponse = JsonSerializer.Deserialize<ZoomTokenResponse>(responseContent);

            return tokenResponse?.access_token;
        }
        else
        {
            return null;
        }
    }
}

}

Hi @eric.petersson , please verify that the new account has all the permissions enabled to use S2S: Internal apps (Server-to-server)

Then, try re-generating the app credentials and generating a new token with the new account id.

Please let me know if if you’re able to access the API after doing all of this.

Hi Gianni

Yes, indeed it worked out when the new owner just reassigned his credentials.

Thansk for the support!

Regards
Eric

Perfect! Happy to help!

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