CLI produces error of invalid_token

Hi all,

I have run into a little trouble and wondered if you had come across it before. I am using sparkDev. It is refusing to load the list of my cores. So, thinking of a way around that I opened up the CLI and spark list gave me the following error

Retrieving cores… (this might take a few seconds)
listDevices got error: invalid_token
Potentially unhandled rejection [2] invalid_token (WARNING: non-Error used)

The cores that I have are plugged in and breathing cyan so I would expec them to show up.

Any ideas?

Thank you.

:smile:

@Julian, looks like the token on one of your Cores has expired! You just need to update your token :smile:

Just to be clear, when you say

Do you mean that I should reset the access token by clicking in the “reset Token” box on the settings page of the web IDE?

:smile:

Yup!

@Julian,

a quickly way might be to simply logout of Sparkdev and login for now

@peekay123 @kennethlimcp

Before i posted I pressed the reset button in the web ide. It did not work for me at first but after a few hours and on a different PC it has found the corse now.

When you mentioned peekay, about one of the token expiring I was a little confused. Doesn’t all of the cores claimed by me / allocated to my account, have the SAME access token, but different ID’s?

So in effect the access token is for my account not a core?

Thanks for helping me to understand.

:smile:

@Julian,

the access token for your account can be for various things like:

1.) perform API calls to interact with the core

2.) Use the Web IDE

3.) Use Spark-cli

4.) Use Spark-dev

5.) Spark mobile app

6.) Other web app interacting with the Spark cloud API

The token you mentioned is actually called the device id :wink:

1 Like

@kennethlimcp,

Having a bit of a wobble :smile:

I don’t know if these things are related but I have recently tried to upgrade Spark DEV and it failed. I have pingged @suda, on this topic. So I am back to the web ide and cli. When in the IDE my flash requests time out. When I run sparklist in CLI I get an “invalid token” error. I reset my token last night (13hours ago) but it is still showing on the CLI this morning as invalid token.

Are these events (spark dev failing and token expiry) connected do you think?

How long should a token reset take?

:slight_smile: Thank you

1 Like

@Julian, try logging out of Spark dev and login and it should work immediately. I hope that they switch over to using a non-expiring (till you log out and delete it) access token! :smile:

Thank you for your response. I have tried to upgrade the spark dev and it failed. I have uninstalled it. Is there another way to reset it? In the web IDE it does say now (I don’t know how long it has said it) that the tokens are everlasting, and tells you how to make them elapse if you want to.

Cheers,

Julian

1 Like

@Julian do you have Spark-cli installed?

Trying logging out on Spark-cli and remove the access token then login via Spark dev again

@kennethlimcp

logging out on the cli and logging back in seems to have done the trick.

Thank you.

Spark Dev is still giving me issues, the following error message:-

now the invalid token is sorted out I will uninstall, restart and reinstall and see if that helps.

:smile:

Thanks again

Hi @kennethlimcp @suda

Problem solved.Steps taken,

Logged out of account in CLI,
Uninstalled SparkDev,
Restarted PC,
logged back into CLI- cores identified, all looks OK,
re-installed SparkDev,
All running OK.

Thanks for your help,

:smile:

1 Like

@kennethlimcp

What do you find is the best wasy to get a library into SparkDev?

At the moment I am,

making a new folder and opening it in spark dev.
open the web IDE and locate the library i want to use,
Cut and paste one tab at a time into Spark Dev,
save each tab as a file.

Is there a way to get the library from git hub??

Thank you.

You can see the github link for the library you are interested in and download as a zip :wink:

1 Like

Thanks Ken,

sorry to keep askinh you questions, but …

in spark dev I repeatedly get a undefined error when I try to flash a core. I have tried this with a couple of different cores and different codes.

To be more precise, in the bottom bar, the one where it says, flashing - if your core does not flash magenta then try again. OR success. In my case it waits a minute or so and then says Undefined…

  1. is there a way to read more of the message?
  2. when I flash from the web IDE it times out. :frowning:

any ideas?

Many thanks

1 Like

Quick update, I have reset the core and reconnected it to my wifi network. Still the same. Flashes time out.

I have a breathing cyan led on the core and in the web IDE.

Any ideas on whats wrong or other tests I can do to find out more?

Cheers

:smile:

1 Like

So you switched over to web IDE?

Try looking at the cores tab and see if the core you are trying to flash is :star: and has a breathing cyan light :wink:

Hi Ken,

I have options to use either CLI (its a bit unfriendly having to type in file paths etc.) or Spark Dev ( I go it working) or the Web IDE.

I can confirm that in the web IDE the core I am trying to flash is listed and I have starred it (to pick it to be flashed) and it is brething cyan.

Thanks

1 Like

Haven’t been messing with Spark dev but you can use Spark dev to modify code and use the Spark-cli to flash the code if it works using Spark-cli :smile:

Will let you know if i test it out!