forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimeo.js
More file actions
47 lines (39 loc) · 1.08 KB
/
vimeo.js
File metadata and controls
47 lines (39 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(function(hello) {
var baseUrl = 'https://api.vimeo.com/';
hello.init({
vimeo: {
name: 'Vimeo',
oauth: {
version: 2,
auth: baseUrl + 'oauth/authorize',
grant: baseUrl + 'oauth/access_token',
response_type: 'code'
},
login: function(p) {
// Instruct node-oauth-shim to pass an extra Authorization header when granting
// Authorization: basic base64(client_id:cient_secret)
// https://developer.vimeo.com/api/authentication#generate-redirect
p.qs.state.authorisation = 'header';
},
xhr: function(p) {
if (p.method !== 'get' && p.data) {
// Serialize payload as JSON
p.headers = p.headers || {};
p.headers['Content-Type'] = 'application/json';
if (typeof (p.data) === 'object') {
p.data = JSON.stringify(p.data);
}
}
return true;
},
// See https://developer.vimeo.com/api/authentication#scopes
scope: {
basic: 'public',
videos: 'public private',
publish: 'create edit delete interact',
publish_files: 'create edit delete interact upload'
},
base: baseUrl
}
});
})(hello);