# Create Meeting from ASP.Net Page with OAuth Example

**URL:** <https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305>\
**Category:** API and Webhooks\
**Created:** [April 25, 2023, 8:40am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305 "2023-04-25T08:40:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![milaapmp](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@milaapmp](https://devforum.zoom.us/u/milaapmp)\
**Post date:** [April 25, 2023, 8:40am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/1 "2023-04-25T08:40:04Z")

</div>

We are using JWT without any issues as the JWT is going to deprecated so we need to shift to OAuth, I am using the following code

var tokenHandler = new System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler();  
var now = DateTime.UtcNow;  
var apiSecret = “My Secreat Key”;  
byte symmetricKey = Encoding.ASCII.GetBytes(apiSecret);

```
        var tokenDescriptor = new SecurityTokenDescriptor
        {
            Issuer = "My Issuers Code",
            Expires = now.AddSeconds(300),
            SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(symmetricKey), SecurityAlgorithms.HmacSha256),
        };

        var token = tokenHandler.CreateToken(tokenDescriptor);
        var tokenString = tokenHandler.WriteToken(token);

        var client = new RestClient("https://api.zoom.us/v2/users/milaapmp@gmail.com/meetings");
        var request = new RestRequest("", Method.Post);
        request.RequestFormat = DataFormat.Json;
        request.AddJsonBody(new { topic = "Meeting Topic", duration = "10", start_time = "2023-04-30T18:20:00", type = "2" });

        request.AddHeader("authorization", String.Format("Bearer {0}", tokenString));
        RestResponse restResponse = client.Execute(request);
        HttpStatusCode statusCode = restResponse.StatusCode;
        int numericStatusCode = (int)statusCode;
        var jObject = JObject.Parse(restResponse.Content);

        Host.Text = (string)jObject["start_url"];
        Join.Text = (string)jObject["join_url"];
        Code.Text = Convert.ToString(numericStatusCode);

```

Can I use the same code just change the OAuth Client Key and Secret or any changes, If you have any example of sample code request to share

Thanks  
tarun

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [April 27, 2023, 6:32pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/3 "2023-04-27T18:32:44Z")

</div>

Hi @milaapmp  
Thanks for reaching out to us! I am happy to help here!

The only thing that you need to change is the way yo generate your token.  
For the JWT app, you use your API key and secret to generate a JWT token.

In the case of the Server to Server oauth app, you will need to make a post request to our Oauth endpoint using your client ID, client secret, and account ID, to get the access\_token.

Then that token will be used in the same way that you are currently using it.

Here is a link to our Docs:  
[https://developers.zoom.us/docs/internal-apps/#use-account-credentials-to-get-an-access-token](https://developers.zoom.us/docs/internal-apps/#use-account-credentials-to-get-an-access-token)

Cheers,  
Elisa

---

<div class="post-metadata">

**Author:** ![milaapmp](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@milaapmp](https://devforum.zoom.us/u/milaapmp)\
**Post date:** [April 28, 2023, 10:57am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/4 "2023-04-28T10:57:36Z")

</div>

Hi Elisa,

Thanks for response, I have used the code to generate the token.

var client = new RestClient(“[Sign In | Zoom](https://zoom.us/oauth/authorize?response_type=code&client_id=iBnqJNr7TvK89qiVAfpLTA&redirect_uri=https%3A%2F%2Fmpmilaap.in%2FCreate)”);  
var request = new RestRequest(“”, Method.Post);  
request.AddHeader(“Authorization”, “HSrRBUOaUTbUL6bV1UXKTGXvgKem5PY2”);

```
        RestResponse response = client.Execute(request);
        Label1.Text = response.Content;

```

I refer the code from the given link below, but the token is not generating, it will shift to zoom

> [@Generate Authorization code and token c# code](http://devforum.zoom.us/t/generate-authorization-code-and-token-c-code/39197/2):
>
> Hi @mnf, Thanks for reaching out about this. Have you had a chance to look over our OAuth Guide? The first step, if you haven’t already, is to [create an OAuth App](https://marketplace.zoom.us/docs/guides/build/oauth-app) to generate your Client ID and Secret. From there, you will then need to follow steps 1 and 2 in our guide: retrieving the code from your redirect URL after the user installs the app, and then using that code in step 2 to fetch an access token. Your second request (after you retrieve the code), should look something like this: var…

Request to help

Best Regards  
Tarun

---

<div class="post-metadata">

**Author:** ![milaapmp](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@milaapmp](https://devforum.zoom.us/u/milaapmp)\
**Post date:** [April 28, 2023, 11:01am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/5 "2023-04-28T11:01:58Z")

</div>

Sorry for the last response, but I am able to generate the token, request to check and confirm

[https://mpmilaap.in/Create?code=qoWZSLAuLi7SrnMGQf-QLmQlCYmksPReA](https://mpmilaap.in/Create?code=qoWZSLAuLi7SrnMGQf-QLmQlCYmksPReA)

Now where I need to pass it with Client Secret

Thanks

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [April 28, 2023, 1:02pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/6 "2023-04-28T13:02:34Z")

</div>

hey @milaapmp  
Could you please confirm if you are trying to migrate to Server to Server Oauth or Just OAuth admin level app?

---

<div class="post-metadata">

**Author:** ![milaapmp](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@milaapmp](https://devforum.zoom.us/u/milaapmp)\
**Post date:** [May 4, 2023, 10:27am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/7 "2023-05-04T10:27:38Z")

</div>

> [@elisa.zoom](#):
>
> Server to Server Oauth

Hi, As I just want to create and manage meetings from my portal as I was using JWT then I was able to create meetings from my portal.

I need that

Thanks

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [May 4, 2023, 1:15pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/8 "2023-05-04T13:15:28Z")

</div>

Hey @milaapmp  
So your best choice here would be to user our Server to Sever OAuth app  
The only thing that changes is the token generation (the API calls will remain the same)

With the JWT app type you use your API key and Secret to create a JWT token.  
With the Server to Server OAuth endpoint, you will use the credentials associated with your app (account ID, client ID and client Secret) to request an access\_token to our OAuth endpoint

Here’s a helpful post on how to generate access tokens using Postman

> [@How to user Server-to-Sever OAuth app with Postman](https://devforum.zoom.us/t/how-to-user-server-to-sever-oauth-app-with-postman/70848):
>
> How to use our Server-to-Server OAuth with Postman? As some of you might be aware of, our JWT app is being deprecated by June 2023 and we encourage you to migrate to the newly introduced [Server-to-Server OAuth App](https://marketplace.zoom.us/docs/guides/build/server-to-server-oauth-app) That being said, here is a quick and simple guide on how to use or new app with Postman As stated in our documentation here: This new app type facilitates OAuth-authenticated requests between servers without end-user involvement. And this grant type enable your private server a…

---

<div class="post-metadata">

**Author:** ![milaapmp](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@milaapmp](https://devforum.zoom.us/u/milaapmp)\
**Post date:** [June 16, 2023, 12:53pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/9 "2023-06-16T12:53:07Z")

</div>

Hi Elisa,  
I am Tarun Bamba

I have created the OAuth App in the panel ,  
Using the following [ASP.Net](http://ASP.Net) code , I am not able to get the token , can you help me out where I am missing, I followed the steps from documentation, also test with postman

Thanks

using System;  
using System.Net.Http;  
using System.Net.Http.Headers;  
using System.Threading.Tasks;

public class ZoomMeeting  
{  
private const string BaseUrl = “[https://api.zoom.us/v2](https://api.zoom.us/v2)”;  
private const string ClientId = “My\_CLIENT\_ID”;  
private const string ClientSecret = “My\_CLIENT\_SECRET”;

```
public async Task<string> CreateMeeting()
{
    // Step 1: Get an access token
    var accessToken = await GetAccessToken();

    if (string.IsNullOrEmpty(accessToken))
    {
        // Handle error when unable to retrieve the access token
        return "Failed to retrieve access token";
    }

    // Step 2: Create a meeting
    var httpClient = new HttpClient();
    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

    var request = new
    {
        topic = "Sample Meeting",
        type = 2, // Scheduled meeting
        start_time = DateTime.UtcNow.AddMinutes(10).ToString("yyyy-MM-ddTHH:mm:ssZ"), // Start time in UTC
        duration = 60, // Duration in minutes
        timezone = "America/Los_Angeles",
        settings = new
        {
            join_before_host = true,
            mute_upon_entry = true,
            auto_recording = "cloud"
        }
    };

    var json = Newtonsoft.Json.JsonConvert.SerializeObject(request);
    var content = new StringContent(json);
    content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

    var createMeetingUrl = $"{BaseUrl}/users/me/meetings";
    var response = await httpClient.PostAsync(createMeetingUrl, content);

    if (response.IsSuccessStatusCode)
    {
        var result = await response.Content.ReadAsStringAsync();
        // Parse the JSON response to get the meeting details
        // You can retrieve the join URL, meeting ID, and other information from the response
        return result;
    }

    // Handle error when unable to create the meeting
    return "Failed to create meeting";
}

private async Task<string> GetAccessToken()
{
    var httpClient = new HttpClient();
    var request = new
    {
        grant_type = "client_credentials",
        client_id = ClientId,
        client_secret = ClientSecret
    };

    var json = Newtonsoft.Json.JsonConvert.SerializeObject(request);
    var content = new StringContent(json);
    content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

    var tokenUrl = "https://zoom.us/oauth/token";
    var response = await httpClient.PostAsync(tokenUrl, content);

    if (response.IsSuccessStatusCode)
    {
        var result = await response.Content.ReadAsStringAsync();
        dynamic jsonResult = Newtonsoft.Json.JsonConvert.DeserializeObject(result);
        return jsonResult.access_token;
    }

    return null;
}

```

}

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [June 16, 2023, 2:32pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/10 "2023-06-16T14:32:30Z")

</div>

Hi @milaapmp  
Thanks for reaching out to us!  
It looks like you are passing the wrong grant\_type when generating your access\_token,.  
Make sure that the grant\_type is **account\_credentials** instead of client\_credentials  
 ![Screenshot 2023-06-16 at 10.32.05 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/1/3/1334545b4f620bac9ca12cc98763d72ba6fbb907.png)

Let me know if that helps!  
Cheers,  
Elisa

---

<div class="post-metadata">

**Author:** ![zainnabbas.ibs](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/zainnabbas.ibs/32/50213_2.png) [@zainnabbas.ibs](https://devforum.zoom.us/u/zainnabbas.ibs)\
**Post date:** [July 13, 2023, 5:01am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/11 "2023-07-13T05:01:05Z")

</div>

Hi there i create C# application and i configer Client ID, Client Secret in me application, and i also have redirect url. and this is final look of request to authorize use (step1): var authorizeUrl = $“[Error - Zoom](https://zoom.us/oauth/authorize?response_type=code&client_id=%7BclientId%7D&redirect_uri=%7BredirectUri%7D)”; but is whill not working i get whole html code if sign in pageof zoomauthorize in my response body. Note i call a request using swagger

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [July 13, 2023, 3:01pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/13 "2023-07-13T15:01:52Z")

</div>

Hi @zainnabbas.ibs  
Thanks for reaching out to us.  
It looks like you are using an Oauth app for authorization and to generate your access token.  
Here is a link to our Docs:

> **[OAuth for user authorized apps](https://developers.zoom.us/docs/integrations/oauth/)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

---

<div class="post-metadata">

**Author:** ![milaapmp](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@milaapmp](https://devforum.zoom.us/u/milaapmp)\
**Post date:** [August 26, 2023, 11:16am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/14 "2023-08-26T11:16:01Z")

</div>

Dear Elisa,

Greetings.

We have created a page with all OAuth feature [http://mpmilaap.in.net/zoomtest](http://mpmilaap.in.net/zoomtest)  
This is a test link where we are click on the create button it will move to Zoom page, after login it will back with token and create the meeting successfully, but it will accept our registered zoom id only, other will not work

Can you help me that once we click on the create button on the given URL , it will create the meeting link without Zoom Login,

Thanks

Tarun Bamba

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [August 28, 2023, 1:38pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/15 "2023-08-28T13:38:59Z")

</div>

Hi @milaapmp  
Thanks for reaching out to us.  
If you want users outside of your account to use your app, you will need to publish your app in the Zoom Marketplace

> **[Publishing apps](https://developers.zoom.us/docs/distribute/)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

---

<div class="post-metadata">

**Author:** ![milaapmp](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@milaapmp](https://devforum.zoom.us/u/milaapmp)\
**Post date:** [September 1, 2023, 3:49pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/16 "2023-09-01T15:49:28Z")

</div>

But then from marketplace every user can use it, If I want to restrict for 20 users ?

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [September 6, 2023, 2:26pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/17 "2023-09-06T14:26:10Z")

</div>

@milaapmp  
You can publish your app and have it private in the Marketplace team  
And only share the app with the users that you want to use your app

---

<div class="post-metadata">

**Author:** ![dibakar.info05](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@dibakar.info05](https://devforum.zoom.us/u/dibakar.info05)\
**Post date:** [November 7, 2023, 6:55am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/18 "2023-11-07T06:55:27Z")

</div>

Hi my code is following to create meeting using zoom from [asp.net](http://asp.net) c#  
public async Task CreateMeeting()  
{  
// Step 1: Get an access token  
var accessToken = await GetAccessToken();

```
        if (string.IsNullOrEmpty(accessToken))
        {
            // Handle error when unable to retrieve the access token
            return "Failed to retrieve access token";
        }

        // Step 2: Create a meeting
        var httpClient = new HttpClient();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

        var request = new
        {
            topic = "Sample Meeting",
            type = 2, // Scheduled meeting
            start_time = DateTime.UtcNow.AddMinutes(10).ToString("yyyy-MM-ddTHH:mm:ssZ"), // Start time in UTC
            duration = 60, // Duration in minutes
            timezone = "America/Los_Angeles",
            settings = new
            {
                join_before_host = true,
                mute_upon_entry = true,
                auto_recording = "cloud"
            }
        };

        var json = Newtonsoft.Json.JsonConvert.SerializeObject(request);
        var content = new StringContent(json);
        content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

        var createMeetingUrl = $"{BaseUrl}/users/me/meetings";
        var response = await httpClient.PostAsync(createMeetingUrl, content);

        if (response.IsSuccessStatusCode)
        {
            var result = await response.Content.ReadAsStringAsync();
            // Parse the JSON response to get the meeting details
            // You can retrieve the join URL, meeting ID, and other information from the response
            return result;
        }

        // Handle error when unable to create the meeting
        return "Failed to create meeting";
    }

    private async Task<string> GetAccessToken()
    {
        var httpClient = new HttpClient();
        var request = new
        {
            grant_type = "account_credentials",
            client_id = ClientId,
            client_secret = ClientSecret
        };

        var json = Newtonsoft.Json.JsonConvert.SerializeObject(request);
        var content = new StringContent(json);
        content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

        var tokenUrl = "https://zoom.us/oauth/token";
        var response = await httpClient.PostAsync(tokenUrl, content);

        if (response.IsSuccessStatusCode)
        {
            var result = await response.Content.ReadAsStringAsync();
            dynamic jsonResult = Newtonsoft.Json.JsonConvert.DeserializeObject(result);
            return jsonResult.access_token;
        }

        return null;
    }

```

But it showing error " _The request was aborted: Could not create SSL/TLS secure channel._"  
when hit this " await httpClient.PostAsync" while creating token.  
what is the solution for this  
kindly help

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [November 7, 2023, 3:26pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/19 "2023-11-07T15:26:56Z")

</div>

Hi @dibakar.info05  
I have not seen this error myself.  
Could you please try generating an access token with postman and making an API call to make sure that this is not an issue on our end?

> [@How to user Server-to-Sever OAuth app with Postman](https://devforum.zoom.us/t/how-to-user-server-to-sever-oauth-app-with-postman/70848):
>
> How to use our Server-to-Server OAuth with Postman? As some of you might be aware of, our JWT app is being deprecated by June 2023 and we encourage you to migrate to the newly introduced [Server-to-Server OAuth App](https://marketplace.zoom.us/docs/guides/build/server-to-server-oauth-app) That being said, here is a quick and simple guide on how to use or new app with Postman As stated in our documentation here: This new app type facilitates OAuth-authenticated requests between servers without end-user involvement. And this grant type enable your private server a…

---

<div class="post-metadata">

**Author:** ![dibakar.info05](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@dibakar.info05](https://devforum.zoom.us/u/dibakar.info05)\
**Post date:** [November 8, 2023, 3:54am UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/20 "2023-11-08T03:54:37Z")

</div>

Hi Iam not using Postman.I am using Oauth not server to serverOauth.is this code is ok?Or is it possible to create meeting from localhost?

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [November 8, 2023, 3:32pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/21 "2023-11-08T15:32:18Z")

</div>

I see @dibakar.info05  
sorry for the confusion.  
Here is a sample app that uses the user-level oauth and it showcases token generation

> **[GitHub - zoom/user-level-oauth-starter](https://github.com/zoom/user-level-oauth-starter)**
>
> Contribute to zoom/user-level-oauth-starter development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![leonardosfrancisco](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/leonardosfrancisco/32/55313_2.png) [@leonardosfrancisco](https://devforum.zoom.us/u/leonardosfrancisco)\
**Post date:** [January 8, 2024, 1:40pm UTC](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305/22 "2024-01-08T13:40:35Z")

</div>

> [@dibakar.info05](#):
>
> `https://zoom.us/oauth/token`

Hi Dibakar

I’m .Net Developer and having problem with GetAccessToken too. I dont understand why is so hard.

Have you managed to get the access token? If yes, could you help me please?

[Next page](https://devforum.zoom.us/t/create-meeting-from-asp-net-page-with-oauth-example/87305.md?page=2)
