Get an access token: "error": "invalid_client"

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
tomasavidly
User
Posts: 2
Joined: Tue Jun 25, 2019 6:42 am

Get an access token: "error": "invalid_client"

Post by tomasavidly » Tue Jun 25, 2019 6:47 am

Hi, I am trying to get an access token, but I get:
{
"error": "invalid_client",
"error_description": "Client authentication failed."
}

I am trying to connect from a cloud integration service, Azuqua, do I need some specific config in Bullhorn for this?

Regards, Tomas

lloydevaporate
User
Posts: 11
Joined: Fri May 17, 2019 8:20 am
Contact:

Re: Get an access token: "error": "invalid_client"

Post by lloydevaporate » Fri Jul 12, 2019 3:13 am

Hi tomasavidly,

Could you provide slightly more information.

When making authentication calls you need to send your client_secret, client_id and also your user account information (username & password)

ansarbluecast
User
Posts: 2
Joined: Thu Aug 29, 2019 2:19 pm
Contact:

Re: Get an access token: "error": "invalid_client"

Post by ansarbluecast » Thu Aug 29, 2019 2:34 pm

I am also getting the same issue. Any updates?

mholmemi
User
Posts: 24
Joined: Fri Feb 15, 2019 10:31 am

Re: Get an access token: "error": "invalid_client"

Post by mholmemi » Thu Aug 29, 2019 3:07 pm

Hi ansarbluecast,

This is Mikaela from Bullhorn Support. Perhaps this Getting Started article will be helpful:

http://bullhorn.github.io/Getting-Started-with-REST/

Please let me know at which point you are getting stuck.

Best,
Mikaela
Mikaela Holme-Miller | Tier II/Enterprise Support Analyst

lloydevaporate
User
Posts: 11
Joined: Fri May 17, 2019 8:20 am
Contact:

Re: Get an access token: "error": "invalid_client"

Post by lloydevaporate » Fri Aug 30, 2019 3:37 am

ansarbluecast wrote:
Thu Aug 29, 2019 2:34 pm
I am also getting the same issue. Any updates?
Hi Guys, just a word of warning that BH probably didn't tell you when you set up your API Account.

Check what your redirect URIs have been set to, I spent ages initially trying to get it to work and it was always failing because instead of setting my redirect URI to what I requested (localhost:3000 for testing) it was null. Below is a slightly modified snippet but it's basically how I authenticate my application through a BH user account.

Code: Select all

    $params = [
        CURLOPT_FOLLOWLOCATION => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_MAXREDIRS => 0,
        CURLOPT_POST => 1
    ];
        $type = 'authorization_code&code';
        $config = parse_ini_file('config.ini');
        $client = $config['CLIENT_ID'];
        $secret = $config['CLIENT_SECRET'];
        $url = $config['OAUTH_URL'];

        $ch = curl_init("$url/token?grant_type=$type=$code&client_id=$client&client_secret=$secret");
        curl_setopt_array($ch, $params);
        $response = curl_exec($ch);
Not sure if you're using PHP but I'd recommend json_decode - ing the response to handle it as an associative array. This is how I get my Access Tokens, if you're in the first step of authentication then you need to get your Auth Code. The URL I use for that is:

Code: Select all

"$url/authorize?client_id=$client&response_type=code&username=$username&password=$password&action=Login";
eg: "https://auth.bullhornstaffing.com/oauth/authorize?client_id=kjhsdg89ysdghsdg98h34jkhdsfg&response_type=code&username=Kennith.api&password=SuperSecretKenPassword&action=Login"
If you use that URL for getting the auth code it will return the auth code in the URL when used with these curl params:

Code: Select all

    $params = [
        CURLOPT_FOLLOWLOCATION => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_MAXREDIRS => 0,
        CURLOPT_HEADER => 1
    ];
    

Post Reply