I have Download Particle CLI. and I have setup my Particle from command line and open it in his site and web ide . but form this moment I can not see my access token in the setting . I have see all my access token showed in command promp but I can use any one of them and I dont now why ? Any Can help me thank you
Welcome to the community
How you would like to use your access tokens ?
and could you share with us how you are using them right now ?
The easiest way to get your access token which can be used with all of your dev instead of CLI comand "token create "
is to go to console and click on "View events from a terminal"
like this:
and here is a simple HTML/JS with fetch which can get data from my variable named “status” and print it to console
<html>
<head>
<style>
html {
background-color: blue;
}
</style>
<script type="text/javascript">
const url = "https://api.particle.io/v1/devices/YOUR_DEVICE_ID_HERE/status?access_token=YOUR_ACCESS_TOKEN_HERE";
function get_data(){
fetch(url)
.then((resp) => resp.json())
.then(function(data){
console.log("full data", data);
console.log("just results", JSON.parse(data.result));
})
.catch(function(error) {
console.log(error);
});
}
setInterval(function() {
get_data();
}, 2000);
</script>
</head>
<body>
</body>
</html>
Thank You for Your Fast answering <3
I see where you show to Click in the Photo But I can see in setting
and this access token where you show me
Give to me Access Porvided invalid when I use in my URL
I need to use it in this URL “https://api.particle.io/v1/devices/my_device_ID/led?access_token= my_access_token” method=“POST”
But All the Time I have This in Setting I dont see Access Token
There is no more access token in WEB IDE → settings.
Either you gonna obtain them with “token create” command via CLI then save them and use whatever you will needed, either you can use the method which I showed in previous post.
Will be easier if you will share what you would like to achieve
look my HTML example works perfect with my access token which I obtained from console "View events from a terminal"
Okayy Thank You Thank you !! <3
but Now I solved One of my problem and I thank you. but there is one problem . My Access Token Give when I use in the URL that showed to give ( Access Token Provided Invalid ) but it’s valid because it’s the access token showed where you show me in Event !!!
this is my simple code html to make led High or low
but the access token gived to me from console give Access token provided Invalid
you forgot double quote ->"<- on the beginning of your access token
Make sure that is on the end as well
HAHAHHAHAHAHAH but I’m sure there is no double quote before the access token after the =
yup you are right my fault make sure is not on the end as well and no space after =
There is an easier way to see all your access tokens
particle token list
Just be sure to select on that has not expired (yet).
I think he should be in the end because in the there is one in the first after " https://…
when I remove the space the error become {“ok”:false,“error”:“Function led not found”}
Yup, you are right again should be on the end
The error indicate that you don’t have function “led” on the device which you call to trigger the led
could you show the code which you flash to your dev ?
Thank You So much bro !! I have check all my code for any fault coding there is some problem I have solved all problem every thing great Thank you agin <3
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.