Cannot authorize with access token through CLI

I installed the smartthings cli on my Mac, and it seems to be working, but I’m unable to authorize. When I run smartthings --version, it displays fine. When I run smartthings rooms I get a browser window that pops up asking for me to authorize. I do, and I get " Failure obtaining access token."

I’ve tried getting around that by generation a personal access token, but when I do that smartthings rooms --token=my_token, I get
Error: self signed certificate in certificate chain
Code: SELF_SIGNED_CERT_IN_CHAIN

Any help would be appreciated

Hi, @MABeatty1978!

That’s odd…
Which version of the CLI are you using?

michaels-mbp /tmp % smartthings --version
@smartthings/cli/1.0.0-beta.14 darwin-x64 node-v16.16.0

Ok, I cannot reproduce the issue with the same version.

Can you check if the debug mode shows another message that describes the issue, please?

please check if this command works:

SMARTTHINGS_DEBUG=true smartthings <command>

[2022-08-24T10:21:41.457] [DEBUG] login-authenticator - authentication - enter
[2022-08-24T10:21:41.460] [DEBUG] login-authenticator - login start: listening on port 61973
[2022-08-24T10:21:41.882] [DEBUG] login-authenticator - redirecting to SmartThings. Add a little smartness to your things.
[2022-08-24T10:22:04.543] [DEBUG] login-authenticator - making axios request: https://oauthin-regional.api.smartthings.com/oauth/token
[2022-08-24T10:22:04.635] [ERROR] login-authenticator - error obtaining token: self signed certificate in certificate chain
[2022-08-24T10:22:09.675] [ERROR] login-authenticator - unable to get authentication info
logging in… failed

Thank you for the info, one last thing to generate a report about this:

  1. Confirm if your email used in SmartThings is the same you use in this forum.
  2. Provide access to your account:
    1. Go to the SmartThings Web (my.smartthings.com)
    2. Log in to your Samsung Account
    3. Select Menu (⋮) and choose Settings
    4. Toggle on Account Data Acces
    5. Select the time period and confirm - In this step, please select “Until turned off”, once the team finishes, we’ll let you know so you can disable it again.

Yes, same email address and provided access. Thank you.

OK, thank you for the info.

I already reported the issue to the team. I’ll keep you posted.

Hi, @MABeatty1978!

Following up on this case.
The team hasn’t been able to replicate the issue even using your account, so, we’d like to know more about your environment, so could you provide the following, please?

  • Are you using a VPN or Proxy? If so, which one?
  • What is your default browser (and which version is it using)?

Running into same issue behind SVPN,

After successful login hitting the authorization button on SmartThings - Authorize
It appears the [localhost:61973/finish?code=54w5ph] is running into an issue that results in Failure obtaining access token.

Hi @Luthrajat ,
To address the authorization issue with the SmartThings CLI, please follow these steps:

  1. Check CLI Version:
    Verify the version of the CLI you are using. This is important to ensure you are on a compatible and updated version. Run the following command:

    smartthings --version
    
  2. Verify Certificate Configuration:
    The error “self signed certificate in certificate chain” indicates a problem with the SSL certificate. This may occur if your system is trying to use an untrusted certificate. You can try configuring the CLI to ignore these certificate errors (not recommended for production environments) or add the correct root certificate.

  3. Configure Access Token:
    To ensure that your access token is always used, follow the configuration steps in the SmartThings CLI documentation. You can find it at the following link:
    SmartThings CLI Configuration

If the issue persists after following these steps, please provide additional details such as the specific CLI version and your environment configuration for more precise assistance.