0

I know this must have been posted here and I've tried the solutions I've searched across the web but I am still getting the error

{"error":"unsupported_grant_type","error_description":"grant type not supported"} when I try to perform a cURL request to my sandbox org.

I've configured the connected app as follows:

Relaxed IP Restrictions Allowed users to self authorize

Built my cURL request from a Mac terminal: (Tried password with security token also, but same result)

curl --location --request POST 'https://test.salesforce.com/services/oauth2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=password' \ --data-urlencode 'username=xxxxxxx' \ --data-urlencode 'password=xxxxx' \ --data-urlencode 'client_id=xxxxxxxx' \ --data-urlencode 'client_secret=xxxxxxxxx'
    {"error":"unsupported_grant_type","error_description":"grant type not supported"}curl: (3) URL using bad/illegal format or missing URL
    curl: (3) URL using bad/illegal format or missing URL
    curl: (3) URL using bad/illegal format or missing URL
    curl: (6) Could not resolve host: grant_type=password
    curl: (3) URL using bad/illegal format or missing URL
    curl: (6) Could not resolve host: xxxx.com.rdc.phase1
    curl: (3) URL using bad/illegal format or missing URL
    curl: (6) Could not resolve host: password=xxxxx
    curl: (3) URL using bad/illegal format or missing URL
    curl: (6) Could not resolve host: client_id=xxxxxxx
    curl: (3) URL using bad/illegal format or missing URL
    curl: (6) Could not resolve host: client_secret=xxxxxx

Please advise, thank you in advance!

2 Answers 2

0

Can you try this

curl -v https://test.salesforce.com/services/oauth2/token 
      -d "grant_type=password" -d "client_id=consumer_key" 
      -d "client_secret=consumer_secret" 
      -d "username=username" -d "password=password"
4
  • I tried this and it was success. So is this command similar to Curl POST request ? Sep 10, 2022 at 10:57
  • Yes..this command is mentioned in official documents
    – MIX DML
    Sep 10, 2022 at 10:59
  • Thank you so much.I received the access token from sandbox as response Sep 10, 2022 at 11:03
  • Glad it worked. Please mark this as answer so that it could help others.
    – MIX DML
    Sep 10, 2022 at 11:04
0

I have the same situation as OP but the solution isn't working for me. Keep getting 400 requests. Any idea on what could be causing this?

1
  • Welcome to Salesforce Stack Exchange (SFSE). Please see the notes about "me too!" responses & "asking another, different question" in Why and how are some answers deleted? & be aware that your "answer" will most likely be deleted. Please contribute to SFSE in other ways so that you gain reputation - you only need 15 rep to upvote a question & only 50 to comment under someone else's question. Or you could possibly ask a new question, and in it link to this Q or A for reference.
    – Moonpie
    Sep 28, 2022 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .