I'm using curl to connect to a Salesforce org with OAuth (I'm following this tuto and get stuck at step 3):
1) Perform a User Agent OAuth request to get the session data below:
{
"access_token" : "00DXXXXXXXXXXXX!YYYYYYYYYYYYYYZZZZZZZZZZZZZZZ",
"instance_url" : "https://mysalesforcedomain.my.salesforce.com",
"id" : "https://test.salesforce.com/id/00DXXXXXXXXXX/005ZZZZZZZZZZ",
"token_type" : "Bearer",
"issued_at" : "xxxxxxxxxxxxxxx",
"signature" : "labcABCdefDEF............................."
}
2) Use the Session data to connect to the Salesforce instance:
curl -H "Authorization: Bearer 00DXXXXXXXXXXXX!YYYYYYYYYYYYYYZZZZZZZZZZZZZZZ" https://mysalesforcedomain.my.salesforce.com/services/data/v44.0
3) Salesforce replies the INVALID_AUTH_HEADER errorCode above:
{
"message" : "INVALID_HEADER_TYPE",
"errorCode" : "INVALID_AUTH_HEADER"
}
Like advised, I've taken care of the '!' char in the access token.
What I tried:
- Using only quotes keeping the '!' - I get a bash error
- Use a backslash before the '!' in the session Id - returns INVALID_AUTH_HEADER
- Use %21 in place of the '!'- returns INVALID_AUTH_HEADER
- Use an incorrect Session ID - returns INVALID_SESSION_ID
I'm using a macbook with OS X 10.14.4.
What's wrong and what should I do to succeed ?
Thank you for your help