Login-authenticator - unable to get authentication info

i made some changes today to my System to remove an SSL error connecting Visual Studio to GitHub (unrelated to Smartthings but relevant). now, the CLI is having issues with the proxy server any idea?

i cleared all the cache as i had seen @nayelyz mention in another thread and i added the debug environment variable for the logging


C:\Program Files (x86)\SmartThings>smartthings.exe locations
[2023-03-07T16:56:18.788] [DEBUG] login-authenticator - authentication - enter
[2023-03-07T16:56:18.797] [DEBUG] login-authenticator - login start: listening on port 61973
[2023-03-07T16:56:19.687] [DEBUG] login-authenticator - redirecting to https://oauthin-regional.api.smartthings.com/oauth/authorize
[2023-03-07T16:56:23.693] [DEBUG] login-authenticator - making axios request: https://oauthin-regional.api.smartthings.com/oauth/token
[2023-03-07T16:56:23.738] [ERROR] login-authenticator - error obtaining token: getaddrinfo ENOTFOUND proxy.*[my company's domain]*.com
[2023-03-07T16:57:26.471] [ERROR] login-authenticator - unable to get authentication info

Hi, @AZSteve
So, as you mentioned the domain of your company appears next to the error it seems the connection is being blocked by a proxy, right?

I’ll ask the engineering team to see if we need certain info to investigate this issue.

1 Like

Following up, @AZSteve

The team mentioned the issue is when trying to redirect back to the server running on localhost.
If you have restrictions set to open up localhost to the web browser, you can use a Personal Access Token instead. Here’s info about how to configure it for the CLI’s use GitHub - SmartThingsCommunity/smartthings-cli: Command-line Interface for the SmartThings APIs.

This was working last week. I took some steps to add some certificates into a directory as needed to make Visual studio play nice with GitHub… sine then it is not working. I don’t know enough on the networking side of things to understand if the two are related or how to overcome the issue… I am really good a system design and factory automation, but networking… ehhh… black box, I just trust my IT and infra teams :blush:

i tried that, same error, it did skip the redirect to authorize though, but result is the same :thinking:

C:\Program Files (x86)\SmartThings>smartthings.exe rules
[2023-03-08T16:50:26.100] [DEBUG] rest-client - making axios request: {"url":"https://api.smartthings.com/locations","method":"get","headers":{"Content-Type":"application/json;charset=utf-8","Accept":"application/json","User-Agent":"@smartthings/cli/1.1.2 win32-x64 node-v16.16.0","Accept-Language":"en-US","Authorization":"Bearer 57988826-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}
    Error: getaddrinfo ENOTFOUND proxy.[company domain].com
    Code: ENOTFOUND

I did try to paste the locations URL into my browser,

  `https://api.smartthings.com/locations`

that succeeds and does return my location ID

i tried to make the call directly… received a FORBIDDEN return.


my token has the following permissions

:face_with_raised_eyebrow:

Hi, @AZSteve
Can you try using cURL to send a command directly to the API to see if that works, please?
You can use the sample below, remember to replace YOUR_PAT_HERE with the actual value:

curl -H "Authorization: Bearer YOUR_PAT_HERE" -H "Content-Type: application/json;charset=utf-8" -H "Accept: application/json" -H "Accept-Language: en-US" https://api.smartthings.com/locations

now we are getting somewhere… the curl option works. i then tried the CLI, it also works…-ish

in both cases, the call for locations works, they both (cURL and CLI) return my locations (only 1)… but when i extend that to rules… they both return empty

the call(s) do however work for scenes. i get the list of all my scenes using both the cURL and CLI methods

C:\Program Files (x86)\SmartThings>smartthings.exe rules
[2023-03-09T09:51:12.322] [DEBUG] rest-client - making axios request: {"url":"https://api.smartthings.com/locations","method":"get","headers":{"Content-Type":"application/json;charset=utf-8","Accept":"application/json","User-Agent":"@smartthings/cli/1.1.2 win32-x64 node-v16.16.0","Accept-Language":"en-US","Authorization":"Bearer 57988826-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}
[2023-03-09T09:51:12.944] [DEBUG] rest-client - making axios request: {"url":"https://api.smartthings.com/rules","method":"get","headers":{"Content-Type":"application/json;charset=utf-8","Accept":"application/json","User-Agent":"@smartthings/cli/1.1.2 win32-x64 node-v16.16.0","Accept-Language":"en-US","Authorization":"Bearer 57988826-xxxx-xxxx-xxxx-xxxxxxxxxxxx"},"params":{"locationId":"ee4756eb-5723-4ed2-b08a-22a2f086f665"}}
no items found

i did notice that i had my company VPN enabled when this works, so i disconnected it, i got the original error so clearly there was a change to the company’s proxy server… i can deal with that, but i i am troubled by the fact that no rules are returned. i checked the functionality, they seem to be running just fine and they are responding as i would expect based on device states.

Did you previously created Rules using the API with the same PAT or you created them using the browser’s authentication?

We’ve seen that if you create them with one token type, you cannot use another to list them.

yes, i used the CLI with the browser authentication… given that the calls are now succeeding, i removed that configuration file (config.yaml at %LOCALAPPDATA%@smartthings\cli) and… it works, i see all my rules, all scenes so i guess the issue is resolved, other than the PAT not returning rules which it is authorized to return, but that’s a small(er) matter…

thank you so much for all your help… this was a great troubleshooting exercise :slight_smile:

Yes, I already reported that issue because it has been confusing for other developers as well.

Thank you for sharing it works now

1 Like

I appreciate your @nayelyz help, as always… Thank you

1 Like

Anytime, @AZSteve!