Known Issue: Token Can't be Generated if the Password Contains Special Characters

    This article applies to Exalate Classic only. For New Exalate, refer to this documentation

    Problem

    Security token can't be generated and the following error occurs:

    cat << 'EOF' | xargs -I % curl --data-urlencode "grant_type=password" --data-urlencode "client_id=65b14c68994ab54110bf52f356cdeb3a49" --data-urlencode "client_secret=%" --data-urlencode "username=myadmin" --data-urlencode "password=password@123" https://dev82492.service-now.com/oauth_token.do
    ]W4Q3!;Lrc
    EOF
    
    {"error_description":"access_denied","error":"server_error"}%   

    Cause

    The issue occurs when the user's password contains special characters like "$%". It usually happens when you create a user and then set a password for this user using the 'Set password' option.

    Solution

    You can escape the special characters using quotation marks and a backspace right before each special character.

    In this case, password@123 should be overwritten with "password\@123".

    The curl command will have the following look:

    cat << 'EOF' | xargs -I % curl --data-urlencode "grant_type=password" --data-urlencode "client_id=65b14c68994ab54110bf52f356cdeb3a49" --data-urlencode "client_secret=%" --data-urlencode "username=myadmin" --data-urlencode "password="password\@123"" https://dev82492.service-now.com/oauth_token.do
    ]W4Q3!;Lrc
    EOF