-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsns.js
29 lines (28 loc) · 846 Bytes
/
sns.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
const request = require('request-promise-native')
var FB = require('fb');
module.exports = {
async kakao(accessToken) {
const reply = await request('https://kapi.kakao.com/v2/user/me', {
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-type': 'application/x-www-form-urlencoded;charset=utf-8'
},
json: true
});
return reply.id;
},
async facebook(accessToken) {
var result = await FB.api('me', { fields: ['id'], access_token: accessToken })
return result.id;
},
async naver(accessToken){
const reply = await request('https://openapi.naver.com/v1/nid/me', {
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-type': 'application/x-www-form-urlencoded;charset=utf-8'
},
json: true
});
return reply.response.id;
}
}