How do I get access token for local cloud?

photon
Tags: #<Tag:0x00007fe22910e9c0>

#1

I managed to connect my photon to the local cloud using this tutorial. The server displays this on the console when started

Your server IP address is: 10.0.0.10
server started { host: 'localhost', port: 5683 }
Connection from: 10.0.0.9, connId: 1
on ready { coreID: 'xxxxxxxxxxxxxxxxxxxxxx',
  ip: '10.0.0.9',
  product_id: 6,
  firmware_version: 65535,
  cache_key: '_0' }
Core online!

But when I try to access the API like this (Using POSTMAN )

GET http://10.0.0.10:8080/v1/devices

It returns a status 400, like this

{
  "code": 400,
  "error": "invalid_request",
  "error_description": "The access token was not found"
}

How do I get the access token, to be used with the local cloud? I tried using the token present in .json files inside .particle folder, but it says invalid token. I could really use some help with this.


#2

Have you tried generating an access token as outlined here
https://docs.particle.io/reference/device-cloud/api/#generate-an-access-token
(of course targeting your own server instead)

BTW, have you seen the fork of the local cloud server enhanced by @Brewskey?

You can also browse that repo (inlcuding issue reports and pull requests) for possible clues about importing/migrating access tokens.


#3

@ScruffR Thank you so much for the response. I tried generating an access token, using the link that you mentioned, but I couldn’t figure out much about how to get the user. Should I create a local user in my local server(How do I create a local user?) or is it ok to use the particle account for that? I also tried the Brewskey/spark-server, but the local cloud didn’t identify the device, I got the handshake error I think, and also when running the server for the first time, It didn’t create the folders where the keys were supposed to be stored, as mentioned in the readme page.

EDIT: Managed to get the Brewskey/spark-server running, after a thorough re-do, following all the instructions!!