Homey Community Forum

Homey Authorization

I’ve been doing a lot of research and testing for a couple of days now and decided to come here to ask instead since I, to be honest, have absolutely no idea how to do this. I’ve been able to code for quite some time now but I decided to try to connect to homey using node.js. I’ve been following tutorials, on different sites but I can’t get it to work. My problem is trying to connect to homey. My current code looks like this:

const AthomCloudAPI = require('homey-api/lib/AthomCloudAPI');

async function myhome(){

// Create a Cloud API instance
const cloudApi = new AthomCloudAPI({
  clientId: 'MyId',
  clientSecret: 'MySecret',

// Get the logged in user
const user = await cloudApi.getAuthenticatedUser();

// Get the first Homey of the logged in user
const homeyApi = await user.getFirstHomey();

// Create a session on this Homey
const homey = await homey.authenticate();



The error I’m getting is:

APIError: The access token was not found

I understand that I need to authenticate but that’s the part I’m having problems with. How should I do this?