IBM Support

Watson Studio Local 1.2.3.x token failed to retrieve using curl command on linux terminal shell when the user password contains special charachers

Question & Answer


Question

According the organization IT policy, the user password should contains special characters, however this causing problem when we tried to retrieve Watson Studio Local using curl command on Linux shell.

Cause

The problem occurred since bash terminal could not accept special character such as $ (dollar sign) without additional escape char. According my test we can solve the problem by using escape character.

Example:
1) Set password for dsxuser01 to "Pass1234"
2) Confirmed there is no problem to get token from this user
[root@ws1n3-master-1 ~]# curl -k -X GET "https://192.168.0.125/v1/preauth/validateAuth" -H "accept: application/json" -H "username: dsxuser01" -H "password: Pass1234"
{"username":"dsxuser01","role":"Admin","permissions":["administrator","deployment_admin"],"sub":"dsxuser01","iss":"KNOXSSO","aud":"DSX","uid":"1001","authenticator":"default","accessToken":"eyJhbGciOiJLdB1DPdxX...G0stkA","_messageCode_":"success","message":"success"}
3) Change the password to "Pa$$1234" and confirmed we can login with this password
4) Confirmed failed to get token using "Pa$$1234" as password
[root@ws1n3-master-1 ~]# curl -k -X GET "https://9.30.189.195/v1/preauth/validateAuth" -H "accept: application/json" -H "username: dsxuser01" -H "password: Pa$$1234"
{"_messageCode_":"signin_fail","message":"Sorry, we could not verify your username and password.","_statusCode_":401}

Answer

You should add backslash ( \ ) escape character to each special character on your curl command.

Example:
1) Change the password to "Pa$$1234" and confirmed we can login with this password

2) Confirmed there is no problem to get token using "Pa\$\$1234" as password
[root@ws1n3-master-1 ~]# curl -k -X GET "https://9.30.189.195/v1/preauth/validateAuth" -H "accept: application/json" -H "username: dsxuser01" -H "password: Pa\$\$1234"
{"username":"dsxuser01","role":"Admin","permissions":["administrator","deployment_admin"],"sub":"dsxuser01","iss":"KNOXSSO","aud":"DSX","uid":"1001","authenticator":"default","accessToken":"eyJhbGciOiJLdB1DPdxX...G0stkA","_messageCode_":"success","message":"success"}


[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSHGWL","label":"IBM Watson Studio Local"},"Component":"Watson Studio Local","Platform":[{"code":"PF016","label":"Linux"}],"Version":"Watson Studio Local 1.2.3.x","Edition":"n\/a","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

More support for:
IBM Watson Studio Local

Software version:
Watson Studio Local 1.2.3.x

Operating system(s):
Linux

Document number:
1136284

Modified date:
30 December 2019

UID

ibm11136284