-
Notifications
You must be signed in to change notification settings - Fork 7
Sample Code to Get Access Token
kevin-cassia edited this page Mar 8, 2019
·
8 revisions
var credentials = {
id: 'tester',
secret: '816213f8b5c2877d'
};
var access_token = '';
var request = require('request');
var options = {
url : 'http://demo.cassia.pro/api/oauth2/token',
method : 'POST',
form : {'grant_type' : 'client_credentials'},
headers : {
Authorization : 'Basic ' + new Buffer(credentials.id + ':' + credentials.secret, 'ascii').toString('base64'),
}
};
request(options, function(error, req, body) {
if (error) {
console.log(error);
return;
}
var data = JSON.parse(body);
access_token = data.access_token;
console.log(data);
var options = {
url : 'http://demo.cassia.pro/api/client', //you can change this to the IP address and port your Router is using.
method : 'GET',
// form : {'grant_type' : 'client_credentials'},
headers : {
Authorization : 'Bearer ' + access_token,
}
};
});
});
request(options, function(error, request, body) {
console.log(body);
});
});
Copyright © 2021 Cassia Networks, Inc.
RESTful API
-
Traffic Related API
- Scan Bluetooth Devices
- Filter Scanned Data based on Device MAC, RSSI, Name, and UUID
- Enhanced Scan Filter (v2.0 and above)
- Connect/Disconnect to a Target Device
- Batch Connect to a Target Device (v2.0 and above)
- Discover GATT Services and Characteristics
- Read/Write the Value of a Specific Characteristic
- Send Advertise Data
- Get Device Connection Status
- Receive Notification and Indication
- Get RSSI for BLE Connection (v2.0 and above)
-
Secure Pairing API
-
Router Auto-Selection API