Getting/Finding an access token


#1

Hi, i used to be able find the access token for my Photon in the particle console, but not anymore. It seems i now have to generate one with via a complicated method i don’t understand… https://docs.particle.io/guide/how-to-build-a-product/authentication/ I have some questions i hope you can help me witt;

Is the documented method the only one to get an access token? And if so, is there an easy step-by-step instruction on how to generate the access token via the terminal or so?


#2

You can also find and create the access token in Web IDE or CLI.

>particle token
Manage access tokens (require username/password)
Usage: particle token <command>
Help:  particle help token <command>

Commands:
  list    List all access tokens for your account
  revoke  Revoke an access token
  create  Create a new access token

#3

Thanks for the speedy reply. If i retrieve all the tokens via the CLI i get a lot of tokens, but nothing for my Photon as it seems. Just to be clear. I’m looking for the access_token i have to put in a function call like this.

<form action="https://api.particle.io/v1/devices/your-device-ID-goes-here/led?access_token=your-access-token-goes-here" method="POST">


#4

You can use any of the access tokens that haven’t expired yet for any of your devices.

But I’m not sure you can put the access_token into the POST request as an URL-encoded parameter.

You could use Particel API JS or have a look at this slightly dated tutorial


#5

Yes, what ScruffR said. Access tokens are for your account, not a specific device. So any access token for your account can be used with any device in your account.

The easiest place to get one is in https://build.particle.io, in the Settings (gear) icon:


#6

Thx Guys! Problem solved…