Looking for:
Zoom oauth app exampleUsing your terminal, go to the folder where you installed Ngrok, and run ngrok http Change '' to whatever port your Next app will be listening on. Copy the secure Forwarding address to your project's. NB: If you're using a. On your index.
We'll also be using the hook useState. We'll be using it throughout this guide to help us manipulate URLs. And don't forget your Scopes! That's how the customer will know what your app will do with their permission. The Job Continues: When it's redirected back to your site, you will see a code param followed by a random string in the URL.
We'll capture that using a data fetching feature called 'getServerSideProps'. This feature is used for pre-rendering with Next SSR. If you're familiar with writing Node, you won't have much of an issue here. First, we will generate a full URL from our request That's pseudocode of course, so let's turn that into real code. We'll be using Node's Buffer class , which helps in the handling of binary data.
We're almost there. I like using try-catch blocks, as I can handle errors a lot better and the code is more organized using async-await. We'll pass that code into the 'code' param in our new URL, and use the base string we generated in our header. If all goes well, we can then retrieve the user using the access token retrieved from the JSON object that we received from the last request. However, if you've been following along perfectly, you shouldn't have any issues.
Now we need to get this data to the client-side. If called from the client side, CORS errors will be thrown. To get an access token, you'll set scopes for the level of access that your app needs from the user. Zoom presents information about these scopes and access requests to the user.
The user will Authorize or Decline these access permissions for your app. See OAuth Scopes for details. Once the user Authorizes the scopes, your app can request an access token.
To retain this access level, your app can request refesh tokens. If this is the first time that you are requesting authorization from a user, the user will be prompted by Zoom to authorize access for your app.
Set the scopes for your app in the Zoom App Marketplace. See Set Scopes for details. When the user is returned to your app, the state parameter will be included along with the authorization code. This offers better security by enabling clients to use a code challenge and code exchange as part of the initial user authorization request.
See rfc for more information. You can use this access token to make requests to the Zoom API. Access tokens expire after one hour. Once expired, you will have to refresh a user's access token. If successful, the response body will be a JSON representation of your user's refreshed access token:.
Refresh tokens expire after 15 years. The latest refresh token must always be used for the next refresh request. When directing a user to authorize your app, attach a state query parameter to the add link.
This is a quick way to use user-specific endpoints instead of needing to lookup or store the user ID for each token.
No comments:
Post a Comment