You need to sign in to do that
Don't have an account?
Meenakshi P
grant type not supported error - username-password Authentication
Hi,
I am trying to authenticate from salesforce using username-password.
And getting error as: {"error_description":"grant type not supported","error":"unsupported_grant_type"}
I checked other posts regarding this error and have included everything including content-type and also selected 'Relax IP restrictions' in settings. Do we need to pass constant keyword as 'password' here in grant_type?
I have passed the same in my input. Do we need to use some key here instead?
I have passed my salesforces username and password in username and password input parameter (appended Security token at the end in password)
Can you please suggest what is missing here?
I tried with below inputs:
curl -v https://login.salesforce.com/services/oauth2/token -d “grant_type=password” -d
“client_id=3MVG9R.1XYZ7" -d “client_secret=32513123456" -d “username=tom@gmail.com” -H “password=mypwd123ZwTkOgD” -H "Content_type: application/x-www-form-urlencoded"
I get following complete response with error:
* STATE: INIT => CONNECT handle 0x60002de30; line 1011 (connection #-5000)
* Hostname was NOT found in DNS cache
* Trying 96.43.146.124...
* Adding handle: conn: 0x600069eb0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* 0x60002de30 is at send pipe head!
* - Conn 0 (0x600069eb0) send_pipe: 1, recv_pipe: 0
* STATE: CONNECT => WAITCONNECT handle 0x60002de30; line 1058 (connection #0)
* Connected to login.salesforce.com (96.43.146.124) port 443 (#0)
> Content_type: application/x-www-form-urlencoded
> Content-Length: 207
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 207 out of 207 bytes
* STATE: DO => DO_DONE handle 0x60002de30; line 1263 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x60002de30; line 1384 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x60002de30; line 1395 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 400 Bad Request
< Date: Fri, 24 Apr 2015 22:07:14 GMT
< Set-Cookie: BrowserId=1f5LKt3DT;Path=/;Domain=.salesforce.com;Expires=Tue, 23-Jun-2015 22:07:14 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, no-store
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
<
* STATE: PERFORM => DONE handle 0x60002de30; line 1565 (connection #0)
* Connection #0 to host login.salesforce.com left intact
* Expire cleared
{"error_description":"grant type not supported","error":"unsupported_grant_type"}
I am trying to authenticate from salesforce using username-password.
And getting error as: {"error_description":"grant type not supported","error":"unsupported_grant_type"}
I checked other posts regarding this error and have included everything including content-type and also selected 'Relax IP restrictions' in settings. Do we need to pass constant keyword as 'password' here in grant_type?
I have passed the same in my input. Do we need to use some key here instead?
I have passed my salesforces username and password in username and password input parameter (appended Security token at the end in password)
Can you please suggest what is missing here?
I tried with below inputs:
curl -v https://login.salesforce.com/services/oauth2/token -d “grant_type=password” -d
“client_id=3MVG9R.1XYZ7" -d “client_secret=32513123456" -d “username=tom@gmail.com” -H “password=mypwd123ZwTkOgD” -H "Content_type: application/x-www-form-urlencoded"
I get following complete response with error:
* STATE: INIT => CONNECT handle 0x60002de30; line 1011 (connection #-5000)
* Hostname was NOT found in DNS cache
* Trying 96.43.146.124...
* Adding handle: conn: 0x600069eb0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* 0x60002de30 is at send pipe head!
* - Conn 0 (0x600069eb0) send_pipe: 1, recv_pipe: 0
* STATE: CONNECT => WAITCONNECT handle 0x60002de30; line 1058 (connection #0)
* Connected to login.salesforce.com (96.43.146.124) port 443 (#0)
> Content_type: application/x-www-form-urlencoded
> Content-Length: 207
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 207 out of 207 bytes
* STATE: DO => DO_DONE handle 0x60002de30; line 1263 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x60002de30; line 1384 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x60002de30; line 1395 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 400 Bad Request
< Date: Fri, 24 Apr 2015 22:07:14 GMT
< Set-Cookie: BrowserId=1f5LKt3DT;Path=/;Domain=.salesforce.com;Expires=Tue, 23-Jun-2015 22:07:14 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, no-store
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
<
* STATE: PERFORM => DONE handle 0x60002de30; line 1565 (connection #0)
* Connection #0 to host login.salesforce.com left intact
* Expire cleared
{"error_description":"grant type not supported","error":"unsupported_grant_type"}
Please look at
http://ashishsharmadevsfdc.blogspot.ae/2014/08/a-quick-salesforce-oauth-20-usage.html
I even removed content-type parameter and still it worked. So looks like this is optional.
I have posted separate discussion for SAML Authorization.