This is a quick 3-legged OAuth Authorization Code flow demo that runs using client-side JavaScript with the RingCentral JavaScript SDK v3.x.
Video: https://youtu.be/peC_whCMTqU
Note, please make sure bower
is installed.
$ git clone https://github.com/ringcentral-tutorials/oauth-js-demo
$ cd oauth-js-demo
$ bower install ringcentral#~3.x --save
Edit the ./public/config.js
file to configure your client ID, client secret and redirect URL, etc.
$ cd ./public
$ cp config-sample.js config.js
$ vi config.js
In the Developer Portal, ensure the redirect URI in your config file has been entered in your app configuration. By default, the URL is set to the following for this demo:
http://localhost:8080/oauth2callback.html
Serve the static page with a static web server such as http-server
. You can install it using the following:
$ npm install -g http-server
Start http-server
from the public
folder using:
$ http-server .
You can also serve the static pages with nginx or apache as you like.
Go to the URL:
http://localhost:8080
Then click the button to authorize the demo app and view the access token.