In Workbench I’ve logged in using 2FA, but I’m still getting this error when I try to Partical Cloud Flash:
Flash device failed: You’re not logged in. Please login using particle cloud login before using this command
Error: Command failed: C:\Users\Milton.vscode\extensions\particle.particle-vscode-core-1.4.6\src\cli\bin\windows\amd64\particle.exe cloud flash collision_detection --target 1.1.0 --no-update-check
Flash device failed: You’re not logged in. Please login using particle cloud login before using this command
at makeError (C:\Users\Milton\.vscode\extensions\particle.particle-vscode-core-1.4.6\node_modules\execa\index.js:174:9)
at module.exports.Promise.all.then.arr (C:\Users\Milton\.vscode\extensions\particle.particle-vscode-core-1.4.6\node_modules\execa\index.js:278:16)
@MiltSchreiber that’s odd. you’ll get that error when you are signed-out - are you sure you are signed in?
to confirm, you can run the Particle: Launch CLI command from within Workbench, then run particle whoami in the terminal instance that launches. if it prompts you to login, go ahead and try logging in again.
once you’ve confirmed you are signed in, you can see your token and username in a file named particle.config.json located within your ~/.particle/ directory (on windows, that’s typically in C:\Users\<you>\.particle)
Thank you @m_m. The CLI login worked perfectly, and I was able to flash my Argon.
I tested Particle: Login in the command pallette. Even though it says I’m logged in, I am actually not based on Particle Whoami. Appears there is something wrong with Particle Login in the command pallette. Could be a 2FA issue??
@MiltSchreiber are you saying that running the Particle: Who am I? command within Workbench produces different results than if you run it in the terminal directly by running the Particle: Launch CLI command then running particle whoami?
if so, that’s super-odd. only thing i can think of is to try running Get-Command particle | Select-Object -ExpandProperty Definition (windows equivalent of unix’s which command) in the terminal that launches after running the Particle: Launch CLI command and sharing the output here. but again, under the hood even if you have two copies of the Particle CLI, they should share the same particle.config.json file such that if you are signed in with one, the other is as well. do you perhaps have multiple *.config.json files within your C:\Users\<you>\.particle directory?
To test I deleted particle.config.json. (There was only one copy.) Then I logged in using Particle Login from the command palette. I got the message that I was now logged in. The file particle.config.json was created containing token and user name. I then went into the Particle CLI and did a Particle Whoami, and it replied that I’m not logged in.
Bottom line: I can login successfully using Particle CLI, but not Particle Login from the command palette.
I ran Get-Command particle | Select-Object -ExpandProperty Definition as you suggested. Tried to copy screen shot of results below, but I’m new to this forum. Not sure if you will be able to see it…
…that is, on the C: drive. while your PS prompt shows:
E:\Users\Milton\Documents\Particle\Particle_cds
…where the root is E:
do you have two.particle directories? specifically, do these both exist by chance?
C:\Users\Milton\.particle\particle.config.json
and
E:\Users\Milton\.particle\particle.config.json
Excluding Workbench which ships with its own copy, did you install the Particle CLI stand-alone at any time?
Finally, can you confirm the exact steps you are taking - something like:
1. launch Particle Workbench
2. run the `Particle: Who am I?` command
3. see that i'm logged out, run `Particle: Login` command
4. provide login credentials, see "success" message
5. run the `Particle: Launch CLI` command
6. execute `particle whoami` in the terminal instance that is launched
expected:
cli reports my signed-in username
actual:
cli reports i am signed out
thanks - very much appreciate your help troubleshooting this
in that same powershell terminal, run Get-Command particle | Select-Object -ExpandProperty Definition
share the path output by step 4
launch Particle Workbench
run the Particle: Audit Environment command
review the report it generates and share the APPDATA, HOMEDRIVE, HOMEPATH, and USERPROFILE fields included in the env: section as well as the entire platform section
PS C:\Users\Milton> Get-Command Particle | Select-Object -ExpandProperty Definition
Get-Command : The term ‘Particle’ is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
thanks. ok, so it looks like the correct user directory is:
C:\Users\Milton
and thus your config should live in:
C:\Users\Milton\.particle\particle.config.json
with that in mind, i would:
delete the E:\Users\Milton\.particle\particle.config.json file
sign-in via Particle Workbench:
a: launch VSCode + Workbench
b: run the Particle: Login command
c: provide your credentials
d: confirm you see the “success” message
confirm the E:\Users\Milton\.particle\particle.config.json file has not been recreated