You need to sign in to do that
Don't have an account?
Tim S
REST API invalid authorization code
Hi all,
I have Salesforce Enterprise Edition and I'm trying (for the first time) to get the REST API running to allow customers on my website to retrieve information from a Custom Object.
I am using php and cURL and I have the code as follows:
I get the response:
I am sure that the client Id and client secret are correct. The Connected App has Relax IP Restrictions, All users may self-authorise, no timeout restriction and "Full Access" .
So I am not sure what else I can try here - can someone advise please?
Thank you
Tim
I have Salesforce Enterprise Edition and I'm trying (for the first time) to get the REST API running to allow customers on my website to retrieve information from a Custom Object.
I am using php and cURL and I have the code as follows:
$data = array( 'grant_type' => 'authorization_code', 'client_id' => '3MVG9Y6d_Btp4xp4HAFSNWODZZ3LBsvdnEgg3_mx6jFqaOPXUv4f_Jm_pBpJEBOuKiRm2dy6YmKuKcippwgDz', 'client_secret' => '1868164969908299792', 'redirect_uri' => 'https://www.mywebsite.com/index.php?option=com_chronoforms5&chronoform=testconnectedapp&event=return', 'environment' => 'https://myinstance.salesforce.com/services/oauth2/token' ); $form->data['data'] = $data; $data_param = http_build_query ($data, '&'); $url = "https://myinstance.salesforce.com/services/oauth2/token"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$data_param); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch);
I get the response:
[response] => {"error":"invalid_grant","error_description":"invalid authorization code"}
I am sure that the client Id and client secret are correct. The Connected App has Relax IP Restrictions, All users may self-authorise, no timeout restriction and "Full Access" .
So I am not sure what else I can try here - can someone advise please?
Thank you
Tim
I have resolved this so no need for a reply thank you.
Cheers