Skip to content

Commit e0e3a9d

Browse files
committed
V1 initial commit
Initial commit
1 parent c9ce1a3 commit e0e3a9d

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

.DS_Store

6 KB
Binary file not shown.

index.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,19 @@ const app = express()
1111

1212
app.get('/', (req, res) => {
1313

14-
// Step 1:
15-
// Check if the code parameter is in the url
16-
// if an authorization code is available, the user has most likely been redirected from Zoom OAuth
17-
// if not, the user needs to be redirected to Zoom OAuth to authorize
18-
19-
if (req.query.code) {
20-
21-
// Step 3:
14+
// Step 1:
2215
// Request an access token using the auth code
2316

24-
let url = 'https://zoom.us/oauth/token?grant_type=authorization_code&code=' + req.query.code + '&redirect_uri=' + process.env.redirectURL;
17+
let url = 'https://zoom.us/oauth/token?grant_type=account_credentials&account_id=' + process.env.account_id;
2518

2619
request.post(url, (error, response, body) => {
2720

2821
// Parse response to JSON
2922
body = JSON.parse(body);
3023

31-
// Logs your access and refresh tokens in the browser
24+
// Logs your access tokens in the browser
3225
console.log(`access_token: ${body.access_token}`);
33-
console.log(`refresh_token: ${body.refresh_token}`);
34-
26+
3527
if (body.access_token) {
3628

3729
// Step 4:
@@ -41,7 +33,8 @@ app.get('/', (req, res) => {
4133
// The `/me` context restricts an API call to the user the token belongs to
4234
// This helps make calls to user-specific endpoints instead of storing the userID
4335

44-
request.get('https://api.zoom.us/v2/users/me', (error, response, body) => {
36+
request.get('https://api.zoom.us/v2/users/' + process.env.user_id, (error, response, body) => {
37+
console.log(`User Id is ${process.env.user_id}`)
4538
if (error) {
4639
console.log('API Response Error: ', error)
4740
} else {
@@ -82,12 +75,12 @@ app.get('/', (req, res) => {
8275
}).auth(process.env.clientID, process.env.clientSecret);
8376

8477
return;
85-
86-
}
78+
79+
})
8780

8881
// Step 2:
8982
// If no authorization code is available, redirect to Zoom OAuth to authorize
90-
res.redirect('https://zoom.us/oauth/authorize?response_type=code&client_id=' + process.env.clientID + '&redirect_uri=' + process.env.redirectURL)
91-
})
83+
// res.redirect('https://zoom.us/oauth/authorize?response_type=code&client_id=' + process.env.clientID + '&redirect_uri=' + process.env.redirectURL)
84+
//})
9285

9386
app.listen(4000, () => console.log(`Zoom Hello World app listening at PORT: 4000`))

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"request": "^2.88.0"
2323
},
2424
"devDependencies": {
25-
"nodemon": "^2.0.2"
25+
"nodemon": "^2.0.15"
2626
}
27-
}
27+
}

0 commit comments

Comments
 (0)