toitware / ide-tools

Tools for working with Toit in different IDEs
MIT License
2 stars 2 forks source link

CLI single sign on not working #199

Closed AdriaanBurger closed 2 years ago

AdriaanBurger commented 2 years ago

When I try to access my devices via the Toit CLI it prompts me to sign in. I enter my credentials and get redirected to a localhost page which fails. image o load. image image image

floitsch commented 2 years ago

Do you maybe have two different accounts? If the config file thinks that you are one user, but you sign in with a different one, then things don't work correctly. I believe you get the error message you see here.

I think the easiest is to (re)move the existing configuration file in that case.

AdriaanBurger commented 2 years ago

I do not have more than one user account. I have ensured that there is only one instance in my configuration. Removed/recreated the config file. Manually set the paths to the CLI as well because VSCode does not pick up toit installation although it is found on my system using "where toit". Still no luck

floitsch commented 2 years ago

Any chance the connection is blocked by a firewall?

floitsch commented 2 years ago

Investigated a bit more: normally the oauth connects to a local http (not https) connection. However, in your case it seems like it wants to connect with https (thus giving an "ERR_SSL_PROTOCOL_ERROR"). There seems to be something that tries to upgrade the connection from http to https, even though we are working on the same computer (localhost).

Which browser/version are you using? Do you have any extension that could do this?

AdriaanBurger commented 2 years ago

I have disable my firewall and added rules to allow all ports for inbound and outbound, as well as the program. Still no luck.

floitsch commented 2 years ago

Apparently there is a sticky flag in Chrome that auto-upgrades connections once they have been upgraded once.

Have a look at chrome://net-internals/#hsts and query "localhost", to see if there is some information. If yes, delete the domain security policies for it. (Normally there isn't one for localhost).

https://stackoverflow.com/questions/25277457/google-chrome-redirecting-localhost-to-https

AdriaanBurger commented 2 years ago

Hi. That worked for me. Thank you very much.