-
Hi! I am migrating our existing JWT implementation to OAuth server-to-server. I created an OAS2S app in zoom, grabbed the details, setup a bunch of scopes (it would be cool to have a list of which scopes zoomnet needs for which services :) ) and activated it. Whenever I attempt to use a client created with OAuthConnectionInfo.ForServerToServer using the apps account id/client id/client secret it gives me an exception: Exception User does not exist: -6uh*****************w. Weird stuff: if I deactivate the app in zoom then the exception changes to app is disabled. It finds the app just fine. The moment I activate it, it says user does not exist. Maybe this is my fault - but one thing I noticed is the exception outputs the account id and there is a period on the end. No other exceptions i've received in my logging have a period on the end and im wondering if its somehow getting added to my account id? I have output the account id to log before creating the connection info and zoom client, no period there. Maybe just zoom puts a period at the end of that one message, but i'm running out of ideas :D any thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I am not too too alarmed by the extra period. My guess is it's simply added to the error message but to be sure, you should use a proxy tool to visually inspect the request being sent to Zoom and their response and confirm everything is being sent as expected. I personally like Fiddler Classic but you can use other tools as well and you configure ZoomNet to send request through this proxy like so: var clientId = Environment.GetEnvironmentVariable("ZOOM_OAUTH_CLIENTID", EnvironmentVariableTarget.User);
var clientSecret = Environment.GetEnvironmentVariable("ZOOM_OAUTH_CLIENTSECRET", EnvironmentVariableTarget.User);
var accountId = Environment.GetEnvironmentVariable("ZOOM_OAUTH_ACCOUNTID", EnvironmentVariableTarget.User);
var connectionInfo = OAuthConnectionInfo.ForServerToServer(clientId, clientSecret, accountId);
var proxyPort = 8888; // By default Fiddler Classic uses port 8888; if you use another proxy tool you'll have to figure out which port it uses
var proxy = new WebProxy($"http://localhost:{proxyPort}");
var client = new ZoomClient(connectionInfo, proxy); I am guessing you are getting this error message when invoking a method that requires you to specify a user id. Something along the lines of: var myUser = await client.Users.GetAsync("6uh*****************w", cancellationToken).ConfigureAwait(false); Maybe there's a slight typo in the user name? These are just guesses on my part. It's impossible for me to know why Zoom is rejecting the userId. To eliminate these two possibilities you should try replacing the userid with Zoom's special keyword: var myUser = await client.Users.GetAsync("me", cancellationToken).ConfigureAwait(false); Let me know if any of this helps.
ZoomNet doesn't need any scopes, it's the Zoom API that dictates which scope are necessary for each endpoint. Maybe you mean that the ZoomNet XML comments should document the scopes for each resource method? By copying and pasting from the Zoom documentation maybe? That's not unreasonable but sounds like a tedious task though, not sure I'm interested in signing up for that but I would gladly accept a PR 😁 |
Beta Was this translation helpful? Give feedback.
-
It is true that you must select the scopes that are appropriate for the endpoints you intend to invoke but I just want to be clear that the fact that you use ZoomNet (or any other 3rd party C# library for that matter) is completely irrelevant to which scopes you need to select when you configure your OAuth app. What matters is which Zoom API endpoints are you going to invoke. That's what dictates which scopes you need to select. Maybe I'm reading too much into what you said, but it gave me the impression that you think there are some scopes that are necessary specifically for ZoomNet. The point I'm trying to make is that the C# library you use has absolutely no bearing on the scopes you need.
You can't just randomly pick "whatever looks relevant". You need, at a minimum, to pick the all scopes that are needed (according to Zoom's documentation) to use the endpoints that your C# code will invoke. For instance, in the code sample you posted above you attempt to create a webinar. Therefore you need to select the scopes that Zoom says are necessary to invoke the "Create Webinar" endpoint (which are I hope this makes sense. |
Beta Was this translation helpful? Give feedback.
-
Completely unrelated to this discussion: A detail in the code samples you posted caught my eye. You seem to instantiate short-lived ZoomNet clients like in these two instances: using (var zoomClient = new ZoomClient(new JwtConnectionInfo(connectionDetails.ApiKey, connectionDetails.ApiSecret))) using (var zoomClient = _zoomConnectionService.GetZoomClient(connectionDetails)) I strongly advise against doing this because the ZoomNet client relies on Microsoft's HTTP client to dispatch the requests and constantly instantiating new HTTP clients can lead to socket exhaustion under heavy load. I discussed this situation here. In my opinion, one of the best explanation of the problem with short-lived HTTP clients was written by Simon Simms back in August 2016 but there are many other similar articles you can find with a quick Google search. My recommendation is to do one of two things:
Personally, I think option 1 is simpler. But if you choose option 2 you have two options as far as token management is concerned:
Or you can decide to ignore my recommendation and hope that you never face the dreaded socket exhaustion problem! 😜 |
Beta Was this translation helpful? Give feedback.
I am not too too alarmed by the extra period. My guess is it's simply added to the error message but to be sure, you should use a proxy tool to visually inspect the request being sent to Zoom and their response and confirm everything is being sent as expected. I personally like Fiddler Classic but you can use other tools as well and you configure ZoomNet to send request through this proxy like so: