FAILURE_BAD_CREDENTIAL when executing curl command for authentication token
Hi,
I'm following the Anaplan API and trying to create an authentication token. I'm using the command with my username and password included:
curl -X POST --user YourUser.@anaplan.com:YourPassword https://auth.anaplan.com/token/authenticate
However, when I run it I get an error message FAILURE_BAD_CREDENTIAL. I'm using the correct credentials though. Not sure how to resolve this issue. Password has no special characters in it and I'm not using SSO to login.
Best Answers
-
no, that's a JSON object for requests via http call
I don't know curl but should be something like this
curl -X POST --user Authorization:base64encoded(user_name@anaplan.com:'password') https://auth.anaplan.com/token/authenticate
1 -
curl --user handles base64-encoding the user:password for basic authentication. If you wanted to do it yourself you would directly provide an Authorization header using -H "Authorization: Basic xxxxxx" where xxxxxx is the base64-encoded username:password, but that shouldn't be necessary. The only thing that could trip it up is a colon in the username.
If you pass the -v flag to curl you will get more useful output to standard error. I can't see anything obviously wrong with the command though. What does the response look like?
1
Answers
-
you need to encore in base64 and prepend with "Authorization: "
headers: {
'Authorization': AuthString,
}
0 -
So the command should be something like: "Authorization: "
headers: {
'Authorization': AuthString,
} curl -X POST --user user_name@anaplan.com:'password' https://auth.anaplan.com/token/authenticate0