-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthenticate.js
45 lines (40 loc) · 1.09 KB
/
authenticate.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
41
42
43
44
45
/*
* Copyright (c) 2017
* Qblinks Incorporated ("Qblinks").
* All rights reserved.
*
* The information contained herein is confidential and proprietary to
* Qblinks. Use of this information by anyone other than authorized employees
* of Qblinks is granted only under a written non-disclosure agreement,
* expressly prescribing the scope and manner of such use.
*/
'use strict';
const merge = require('merge');
/**
* get access token of LIFX from Qblinks cloud
*
* @param {object} options Quantum instance
* @param {function} callback callback of this function
*/
function authenticate(options, callback) {
const output = merge({}, options);
const xim_content = options.xim_content || {};
const access_token = xim_content.access_token || '';
if (access_token.length > 0) {
output.xim_content.accessToken = options.xim_content.access_token;
output.result = {
err_no: 0,
err_msg: 'ok',
};
} else {
output.result = {
err_no: 113,
err_msg: 'No Access Token',
};
}
callback(output);
}
/**
* functions exporting
*/
module.exports = authenticate;