Basic questions around authentication using CLI

Please bear with me, I know I am somewhat of a newbie and I have a very messy environment.

I could not get luarocks/lua to work properly on my main PC so I moved to a VM running Ubuntu (ie a very basic clean install, however it is the server lite version) Lua and luarocks is fine.

Now I find that smartthings CLI on Ubuntu is being annoying. I have generated a token and installed in the config and when I do ‘smartthings config’ it shows default config is active

When I do ‘smartthings edge:drivers:install’ it invites me to select a hub, but when I do it returns
Error: Request failed with status code 403: {“requestId”:“ADFEA0C8-E7F9-4418-A6ED-7AC94B9B4279”,“error”:{“code”:“ForbiddenError”,“message”:“Forbidden”,“details”:}}

I can list drivers channels and devices etc with no problem

Luckily the install works fine on my windows machine, (but with no config)

I am debating whether to set up another VM on ubuntu with a desktop as I suspect the authorisation code of smartthings cli tries to request a webpage. I am putting this off as I don’t want to fall down any more rabbit holes

Anyone got any thoughts on what is causing my problem?

Try to use the default Authentication flow. This means, follow these steps:

  1. When you download the latest version of the CLI, run the command smartthings devices only to trigger the OAuth Flow.
  2. It will open a window in your browser asking for authorization.
  3. Click on “Authorize” and wait for the “You can close this window” message. After this, you should have the corresponding result in your terminal.
  4. It seems there are some scopes missing in the Personal Access Token page regarding Edge Drivers, so even if you generate one there and set it up for the CLI, it could cause this kind of errors. (This is already reported)

It will open a window in your browser asking for authorization.

I am running on a ubuntu lite server I don’t think it it ‘can’ open a browser!!! :grinning:

I did mention I am considering running a desktop environment ubuntu, but I seem to be making progress without at the moment so won’t do that for a week or so

Thanks for responding

I can confirm that if smartthings CLI can open a web browser to effect authentication then all is well! However, is it worth flagging that it is problematic on a ‘lite’ desktop-less server? Appreciate this is an ‘edge’ case (excuse the pun :grinning: :roll_eyes: =)

Actually, the issue of the missing scope when creating a Personal Access Token is solved, so now you can create a new one configure your CLI to use it.
Remember to use all the scopes related to Edge (Drivers, Hubs) and all the others you’ll use like Devices, locations, etc.

Oh brilliant. Thanks

Doesn’t seem to have worked

I generated a new token and added it to my config

The version I am running is this
@smartthings/cli/0.0.0-pre.30 linux-x64 node-v12.18.1

Here is the message I get
Error: Request failed with status code 403:

The log file has this

2021-09-28T16:48:50.801Z Error: Request failed with status code 403: {“requestId”:“AC4DCF87-A272-45FB-ACBA-57D603A14668”,“error”:{“code”:“ForbiddenError”,“message”:“Forbidden”,“details”:}}
2021-09-28T16:48:50.801Z at createError (/snapshot/smartthings-cli/node_modules/axios/lib/core/createError.js:16:15)
2021-09-28T16:48:50.801Z at settle (/snapshot/smartthings-cli/node_modules/axios/lib/core/settle.js:17:12)
2021-09-28T16:48:50.801Z at IncomingMessage.handleStreamEnd (/snapshot/smartthings-cli/node_modules/axios/lib/adapters/http.js:260:11)

It happens only for the logcat command?

Does your config.yaml follow this format?

          token: xxxx-xxx-xxxx

Remember you can also use the --token flag in the command. For example:

smartthings devices --token=xxxx-xxx-xxxx