Skip to main content
BubbaBoBobBrain
Gold ⭐️
Oct 20, 2023 6:39 PM UTC
Solved

CDSW CLI - login failed to authenticate on MacOS

Hi,

I have been using the cdswctl tool for a while for creating sessions that can be accessed by VS Code from Windows.

Today i tried to create a session from a Mac using the same command and it throws an error complaining that the API key is not valid.   I have checked the key and same key works fine from Windows.

The command i am using is :

./cdswctl login -n USERNAME -u http://cdsw.mydomain.xxxx/ -y APIKEY

Can anyone offer any advice?

Thanks

BubbaBoBobBrain
Gold ⭐️
Nov 2, 2023 11:17 AM UTC

So - it is related to proxy/dns settings when on RAS.

Adding a lookup to etc/hosts from the IP address to the Host name has fixed my issue:

e.g.

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

192.99.90.1 cdsw.XXXXXX.xxxx

11 replies

DianaTorres
Community Manager
Community Manager
Oct 20, 2023 10:02 PM UTC

@BubbaBoBobBrain Welcome to the Cloudera Community!

To help you get the best possible solution, I have tagged our CDSW experts @Gopinath @Mike  who may be able to assist you further.

Please keep us updated on your post, and we hope you find a satisfactory solution to your query.

Translate
Regards, Diana Torres, Senior Community Moderator
BubbaBoBobBrain
Gold ⭐️
Oct 27, 2023 11:36 AM UTC

Hi - i am still facing a blocker on this.  Can anyone offer any advice?

A colleague with a Mac has also tried and they get the same error:

Failed to authenticate for user <my user name> using provided API key.

Could it be due to case of the usernames?  In CDSW my username is uppercase and on my mac it is lower case?

I have tried putting my username in the login statement matching the case of my CDSW user.

Translate
DianaTorres
Community Manager
Community Manager
Oct 27, 2023 4:11 PM UTC

@Scharan Any insights here? Thanks!

Translate
Regards, Diana Torres, Senior Community Moderator
Mike
Gold ⭐️
Gold ⭐️
Oct 30, 2023 1:47 PM UTC

Hi @BubbaBoBobBrain , you need to include the workspace in your login command, see this page: https://docs.cloudera.com/cdsw/1.10.3/cli-reference/topics/cdsw-login-cdswctl.html

This command worked fine for me:
./cdswctl login -u https://mikes-cdsw.cloudera.com  -n mike -y u8ryf6a2977rfsr8zajesand2jhwoa44

Btw on Mac you usually need to first right click on the cdswcli icon and select "Open" - this will let you open the tool once which lets your mac system trust the application, which it won't do by default since it was downloaded from the internet. After this you can use it as normal.

Translate
BubbaBoBobBrain
Gold ⭐️
Oct 31, 2023 9:30 AM UTC

Hi @Mike ,

Thank you for the reply. 

I have already trusted the the cdswctl application.

I can't see much difference between my command and yours?

The error i am getting is related to the API key.  If i remove the API key it prompts me for a password but then fails as we used SSO.

Translate
Mike
Gold ⭐️
Gold ⭐️
Oct 31, 2023 10:58 AM UTC

Oh weird the first time I read this I didn't see you using the server anywhere. No, the command you are using is correct.

Can you expand on this statement?

>Could it be due to case of the usernames?  In CDSW my username is uppercase and on my mac it is lower case?

The username you are using in the command is the CDSW username, not your mac username.

Translate
BubbaBoBobBrain
Gold ⭐️
Oct 31, 2023 12:05 PM UTC

My Mac logon, home dir and the username at the end of the SSH public key is as follows:

a1234567

But in CDSW the username is:

A1234567

I didn't know if this would cause a conflict?  I have tried both A1234567 and a1234567 in the login statement.

 

Translate
BubbaBoBobBrain
Gold ⭐️
Oct 31, 2023 12:12 PM UTC

I am in the office now rather than working remotely via VPN and it has worked ok. 😃

I will try again at home later and see if the VPN was causing an issue.

Translate
Mike
Gold ⭐️
Gold ⭐️
Oct 31, 2023 1:38 PM UTC

I would expect that you need to use A1234567 as that will be the username which matches the API key.

If the only thing that changed was the VPN... that must be the issue. Perhaps the VPN is blocking ssh access or rewriting some header or something? I'm pretty sure that the error about an invalid API key is not the real error - it likely cannot even get to your CML in the first place. When you get back on VPN, can you try to just cURL your server with and without VPN?

Translate
BubbaBoBobBrain
BubbaBoBobBrainAuthorAnswer
Gold ⭐️
Nov 2, 2023 11:17 AM UTC

So - it is related to proxy/dns settings when on RAS.

Adding a lookup to etc/hosts from the IP address to the Host name has fixed my issue:

e.g.

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

192.99.90.1 cdsw.XXXXXX.xxxx

Translate
Mike
Gold ⭐️
Gold ⭐️
Nov 2, 2023 3:37 PM UTC

Hmm, that makes sense I suppose. That was my next guess 😉 Glad you figured it out, and thanks for posting the answer here, I appreciate it!

Translate