Bullhorn Authorize is not returning auth code

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
debkelly
User
Posts: 4
Joined: Tue Jul 14, 2020 5:02 pm

Bullhorn Authorize is not returning auth code

Post by debkelly »

Hi,

I'm new to the Bullhorn API and need some help getting started.

I did read the "Getting-Started-with-REST " article and I have not been successful getting a code back from the Authorize call using Postman. I have used OAuth 2.0 in the past for reference. Here is the API call:

https://auth.bullhornstaffing.com/oauth ... {{Password}}

I'm getting back a 200, but instead of json, I'm getting HTML which looks like Bullhorn welcome page. Here is some of it:

<!DOCTYPE html>
<html lang="en-US">

<head>

<link rel="stylesheet" type="text/css"
href="https://www.bullhorn.com/wp-content/the ... ?ver=6.3.2">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="google-site-verification" content="wCsmuAuV-9YJpedMPkdrmMyCRQJMpzZw-7vYIXgk1mg" />
<link rel="profile" href="https://gmpg.org/xfn/11">
<title>Recruiting Software | Applicant Tracking System | Bullhorn</title>
<script src="https://code.jquery.com/jquery-2.2.4.js"
integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI=" crossorigin="anonymous"></script>

<!-- This site is optimized with the Yoast SEO plugin v13.0 - https://yoast.com/wordpress/plugins/seo/ -->
<meta name="description"
content="Automate your recruiting lifecycle and make up to 43% more placements with Bullhorn. Demo our leading applicant tracking system and CRM for staffing firms!" />
<meta name="robots" content="max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
<link rel="canonical" href="https://www.bullhorn.com/" />
<meta property="og:locale" content="en_US" />

I tested the username and password by logging into Bullhorn.com. I was able to get in the system, so I know that part is working.

Thanks in advance!
Deb

lciastko
User
Posts: 15
Joined: Wed Feb 26, 2020 12:17 pm

Re: Bullhorn Authorize is not returning auth code

Post by lciastko »

Hi Deb,

Welcome to the Bullhorn Rest API!

Code: Select all

https://auth.bullhornstaffing.com/oauth/authorize?client_id={Client ID}&response_type=code&username={Username}&password={Password}&action=Login
This will return a URL that we can use to obtain a BH REST Token, code=.

For example:

Code: Select all

http://www.bullhorn.com/a/?utm_expid=155673-10.14Pw12I_R3Kmv-gPghUK9A.1&code={Authorization Code}&client_id={Client ID}
Make sure when you are inputting the Client ID, Username, and Password that you are removing the Curly Braces.

Hopefully this works for you!
Lindsay

debkelly
User
Posts: 4
Joined: Tue Jul 14, 2020 5:02 pm

Re: Bullhorn Authorize is not returning auth code

Post by debkelly »

Hi Lindsay,

I am doing as you suggested. This is my code from Postman - the curly braces represent the environment variables I'm using.

{{AccessTokenURL}}/authorize?client_id={{ClientID}}&response_type=code&action=Login&username={{Username}}&password={{Password}}

Why am I getting back HTML? Did you look at that?

Thanks,
Deb

lciastko
User
Posts: 15
Joined: Wed Feb 26, 2020 12:17 pm

Re: Bullhorn Authorize is not returning auth code

Post by lciastko »

Hey again,

When using Postman to execute this, it is expected to return HTML. Instead of looking at the Body, navigate to the Headers Tab in Postman. Here you should see a Location Key that starts with http://bullhorn.com - The code that is returned here is what you are looking for
APICode.PNG
APICode.PNG (19.79 KiB) Viewed 109 times
Hope this helps!
Lindsay

debkelly
User
Posts: 4
Joined: Tue Jul 14, 2020 5:02 pm

Re: Bullhorn Authorize is not returning auth code

Post by debkelly »

Capture.PNG
Capture.PNG (74.92 KiB) Viewed 107 times
There is no location key in my header tab. Also, I getting back 22 headers when you show 9.

MysteryA
User
Posts: 4
Joined: Thu Aug 02, 2018 12:34 pm

Re: Bullhorn Authorize is not returning auth code

Post by MysteryA »

You need to go into the settings in postman and disable "automatically follow redirects". Then try your initial call again, and you'll notice the response code is 302 instead of 200. And you will see the 'location' response header.

I hope this helps you.

lciastko
User
Posts: 15
Joined: Wed Feb 26, 2020 12:17 pm

Re: Bullhorn Authorize is not returning auth code

Post by lciastko »

Hey again,

I'm sorry that this method isn't working. I would try the Postman Settings above. I just toggled this on/off and I was able to get and stop getting the location returned. There is also an alternative if that does not work for you. The Response Code 302 is definitely what we are looking for.

If you click on the "Authorization" tab in Postman, set the "Type" to OAuth 2.0 Then press the "Get New Access Token" button and fill out the fields.

Then when you click "Request Token" it will combine the steps and skip right to the Auth Token Step after you login with the API User's Credentials.
Auth.PNG
Auth.PNG (30.32 KiB) Viewed 97 times

MysteryA
User
Posts: 4
Joined: Thu Aug 02, 2018 12:34 pm

Re: Bullhorn Authorize is not returning auth code

Post by MysteryA »

MysteryA wrote:
Thu Jul 16, 2020 3:26 pm
You need to go into the settings in postman and disable "automatically follow redirects". Then try your initial call again, and you'll notice the response code is 302 instead of 200. And you will see the 'location' response header.

I hope this helps you.
If this doesn't work, try entering the auth url directly into chrome. Sometimes you have to accept the terms and it stops the auth process.

debkelly
User
Posts: 4
Joined: Tue Jul 14, 2020 5:02 pm

Re: Bullhorn Authorize is not returning auth code

Post by debkelly »

Thanks MysteryA. Changing the Postman setting worked!

Regarding the Get New Access Token screen in Postman, I tried that, but keep getting the message "Invalid Redirect URI". My callback URL is blank. Not sure what I need to put there if I don't have one.

Thanks again.
Deb

Post Reply