You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it would be useful to be able to check if a given scope has been granted before invoking a method to avoid getting an exception similar to: Invalid access token, does not contain scopes:[<...the name of the scope(s)...>].
One thing to keep in mind: the .Scopes property on the OAuthConnectionInfo class gets populated when a token is refreshed. This means that his property is NOT populated if the developer specifies a previously issued token when instantiating the connection info like in this example:
varclientId="... your client ID ...";varclientSecret="... your client secret ...";varaccountId="... your account id ...";varaccessToken=Environment.GetEnvironmentVariable("ZOOM_OAUTH_SERVERTOSERVER_ACCESSTOKEN",EnvironmentVariableTarget.User);varconnectionInfo=OAuthConnectionInfo.ForServerToServer(clientId,clientSecret,accountId,accessToken,(_,newAccessToken)=>{Environment.SetEnvironmentVariable("ZOOM_OAUTH_SERVERTOSERVER_ACCESSTOKEN",newAccessToken,EnvironmentVariableTarget.User);});varzoomClient=newZoomClient(connectionInfo);
This means that there is a possibility for the .Scopes property to be empty when the HasPermissions method is invoked. In this scenario, the code in HasPermissions must detect if the list of scopes is empty and, if so, to populate the .Scopes before proceeding. Unfortunately, I am not aware of any way that we can retrieve the list of scopes that have been granted other than to force the current token to be refreshed.
Sometimes it would be useful to be able to check if a given scope has been granted before invoking a method to avoid getting an exception similar to:
Invalid access token, does not contain scopes:[<...the name of the scope(s)...>]
.What I envision is something along these lines:
Also, I envision a similar method to check if multiple scopes have been granted like so:
The text was updated successfully, but these errors were encountered: