-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
40 lines (32 loc) · 1.01 KB
/
test.js
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
var Pocket = require('./src/index')
var config = require('./config.json')
// var REDIRECT_URI = 'http://localhost:3000/redirect'
// var pocket = new Pocket(config)
// pocket.add({url: 'http://ign.com'}).then(pretty).catch(pretty)
// pocket.get({count: 3}).then(pretty).catch(pretty)
// function pretty (data) {
// console.log(JSON.stringify(data, null, 2))
// }
var pocket = new Pocket({
consumer_key: config.consumer_key
})
// pocket.getRequestToken({
// consumer_key: config.consumer_key,
// redirect_uri: REDIRECT_URI,
// state: 'ok'
// }).then(function (params) {
// console.log(params)
// return pocket.getAuthorizeUrl({
// request_token: params.code,
// redirect_uri: REDIRECT_URI
// })
// }).then(console.log).catch(console.error)
pocket.getAccessToken({
consumer_key: config.consumer_key,
code: 'ed7f4bd5-a62c-7558-854a-ff1f3f'
}).then(console.log).catch(console.log)
/**
* { access_token: 'c8502676-84f4-52ce-f6cc-f15b1d',
username: 'trypocket1@mailinator.com',
state: 'ok' }
*/