Cubesensor API authentication error on raspberry pi 2



i encounter an error on running cubesensor api on raspberry pi in my school network. 172.x.x.x

i have no problem running cubesensor api on my laptop (it able to retrieved the sensor value) in my home area network and school network.

below is my code with cubesensor java api

but line List devices = cubeAPI.getDevices(); causing me error.


private static void initialiseCubeSensors(){

CubeSensorsApiV1 cubeAPI = new CubeSensorsApiV1(GetToken.getAccessToken());
if (cubeAPI != null) {
    List<Device> devices = cubeAPI.getDevices();
                Device cubeSensor = devices.get(1);
                State cubeState = cubeAPI.getCurrent(cubeSensor.getUid());

                // get the readings
                Double tempValue =  (double)cubeState.getTemp()/100;
                int humidValue = cubeState.getHumidity();

                System.out.println("temp --> " + tempValue.toString());
                System.out.println("humid --> "+ Integer.toString(humidValue)); 

public static void main (String []args){

Exception in thread “main” com.w3asel.cubesensors.api.v1.CubeSensorsException: {“code”: 401, “ok”: false, “errors”: [“Unauthorized. Something was wrong while trying to authenticate.”]} at com.w3asel.cubesensors.api.v1.CubeSensorsApiV1.getDevices( at bacnet.devices.test.initialiseCubeSensors( at bacnet.devices.test.main(

please help…