Error:Invalid Client after successfully obtaining Auth Code

Forum for users and developers of Bullhorn's API service.

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
Amazing
User
Posts: 3
Joined: Tue Apr 09, 2013 6:12 am

Error:Invalid Client after successfully obtaining Auth Code

Post by Amazing » Tue Apr 09, 2013 6:32 am

Hello

According to the workflow...
1. Obtain an authorization code.
2. Use the authorization code to obtain an access token and a long-lived refresh token.

I am able to successfully get an authorization code but trying to obtain an access token gives me the following error:

"{ "error" : "invalid_client", "error_description" : "Client authentication failed." }"

from the PHP code:

$postfields = array();
$postfields['grant_type'] = urlencode('authorization_code');
$postfields['code'] = urlencode('auth-code');
$postfields['client_id'] = urlencode('f5b7bb33-5ddf-4f99-924d-8245febb6c74');
$postfields['client_secret'] = urlencode('');
$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, 'https://auth.bullhornstaffing.com/oauth/token?');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$array = json_decode($data);

PLEASE HELP.

Thanks

Amazing
User
Posts: 3
Joined: Tue Apr 09, 2013 6:12 am

Re: Error:Invalid Client after successfully obtaining Auth Code

Post by Amazing » Sat Apr 13, 2013 5:31 am

Omitting the redirect_uri from the the Auth Code step resolved this error. Thanks

mpeterson
User
Posts: 5
Joined: Fri Aug 16, 2013 8:18 am

Re: Error:Invalid Client after successfully obtaining Auth Code

Post by mpeterson » Fri Aug 16, 2013 8:30 am

If you have defined more than one redirect_uri and you want to use one other than the first one in the list, you can use the redirect_url in the /auth step but you also need to use the same redirect_uri in the /token step.

Post Reply