AUTH Redirect URL incorrect

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
fyaconiello
User
Posts: 9
Joined: Tue Jun 19, 2012 10:15 am

AUTH Redirect URL incorrect

Post by fyaconiello » Thu Jul 18, 2013 3:38 pm

When I try to get an auth token from the API it redirects me into an error page. It appears that the configured redirect url has an issue.

If I go in my browser to: https://auth.bullhornstaffing.com/oauth ... &password=*******

It redirects me here:
http://auth.bullhornstaffing.com/bullho ... b2545db05e (this page of course doesn't exist)

I believe it should be redirecting to here:
http://subsurfaceglobal.com.gridhosted. ... b2545db05e

hpanesar
User
Posts: 16
Joined: Wed Oct 19, 2011 3:36 am

Re: AUTH Redirect URL incorrect

Post by hpanesar » Fri Jul 19, 2013 9:52 am

Hi,

This issue has now been resolved. The URL was not complete and I have now modified this.

You should now be able to reach the URL without error.

Thanks

Harjot Panesar
BULLHORN

fyaconiello
User
Posts: 9
Joined: Tue Jun 19, 2012 10:15 am

Re: AUTH Redirect URL incorrect

Post by fyaconiello » Fri Jul 19, 2013 11:00 am

I'm attempting to connect to the REST API programmatically as part of a job board. The website needs to be able to make REST calls w/o user interaction. I got the following function from another post in this forum and people seem to be having luck using it. However it isn't working for me.

Code: Select all

function getAuthCode()
{
    $url = "https://auth.bullhornstaffing.com/oauth/authorize?client_id=%s&response_type=code&action=Login&username=%s&password=%s";
    $url = sprintf($url, CLIENT_ID, USER, PASS);
    $data = sprintf("action=Login&username=%s&password=%s", USER, PASS);
    echo sprintf("GET BULLHORN ACCESS TOKEN URL:\n%s\n", $url);

    $curl = curl_init( $url ); 
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, true);
    #curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_AUTOREFERER, true);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120);
    curl_setopt($curl, CURLOPT_TIMEOUT, 120);
    #curl_setopt($curl, CURLOPT_NOBODY, true);
    $content = curl_exec( $curl );
    #print_r(curl_getinfo($curl, CURLINFO_EFFECTIVE_URL));
    print_r($content);
    curl_close( $curl );//die($content);  
         
    if(preg_match('#Location: (.*)#', $content, $r))
    {
        $l = trim($r[1]);
        $temp = preg_split("/code=/", $l);
        $authcode = $temp[1];
    }

    return $authcode;
}
I get the following response back from CURL

Code: Select all

$ php includes/rest/connection.php 
GET BULLHORN ACCESS TOKEN URL:
https://auth.bullhornstaffing.com/oauth/authorize?client_id=912b06b0-ab6a-4eb7-8501-d63de92ede41&response_type=code&action=Login&username=************&password=***********


HTTP/1.1 200 OK
Date: Fri, 19 Jul 2013 14:57:34 GMT
Server: Apache-Coyote/1.1
Content-Type: text/html; charset=UTF-8
Set-Cookie: oAuthSession="-wuZ2RsV_hDYvM6XHErZII0bebMvHPsEN7jynVaTf2vEqoprk9gLdcLQjLQJvWJYKKVVG8kpRaNM8rhFDTr9I5QnDeiSTENWOHiiaKSlIR8oJJIIhxJvCI--9QI2L7qi3xhUY2ne1gxauuA9h5RHpcJ8tdJDa5l61aMkGfvO6Rk="; Version=1; Domain=.bullhornstaffing.com; Path=/
Set-Cookie: JSESSIONID=497F16CAB0AA89E9B9A62230957F2497; Path=/bullhorn-oauth-services-2.0/; HttpOnly
nnCoection: close
Transfer-Encoding: chunked








<html>
<head>
	<title>Bullhorn OAuth - Get Consent</title>
	<meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="apple-touch-fullscreen" content="yes">
    <link rel='stylesheet' type='text/css' href='/oauth/css/consent.css'/>
    <link rel='localizations' type='text/json' href='l10n/localizations.json' />
    <script type="text/javascript" src="js/json2.js"></script>
    <script type="text/javascript" src="js/l10n.js"></script>
    <script type="text/javascript">
    	String.toLocaleString("l10n/localizations.json");
        document.getElementById('tos').innerHTML = "Terms of Service".localize();
        document.getElementById('agreetxt').innerHTML = "Agree".localize();
        document.getElementById('declinetxt').innerHTML = "Decline".localize();
    </script>    
</head>
<body class="login" style="width: 100% !important; height: 100% !important;">
	<form method="post" style="width:100%;">
		<input type="hidden" name="corporationId" value="5394" />
		<input type="hidden" name="masterUserId" value="5305612" />

		<div class="x-docking-vertical">
	        <div id="appLogoPanel"></div>
			<h1>Subsurface Global</h1>
			<h2 id="tos" >Terms of Service</h2>
    <table>
	    <tr>
	        <td valign="top">NA</td>
	    </tr>
	</table>
	<div class="x-container buttons">
       	<div class="x-container buttonContainer">
	        <div class="x-button" onClick="document.getElementById('agreebtn').click();">
	        	<span id="agreetxt" class="x-button-label">Agree</span>
	        	<input id="agreebtn" type="submit" name="action" value="Agree">
	        </div>
		</div>
    	<div class="x-container buttonContainer">
	  		 <div class="x-button" onClick="document.getElementById('declinebtn').click();">
	        	<span id="declinetxt" class="x-button-label">Decline</span>
				<input id="declinebtn" type="submit" name="action" value="Decline">
	        </div>
		</div>
	</div>
</form>
</body>

</html>
AUTH CODE: 
how do I without user intervention get an auth code? My code is unable to click "Agree" on the intermediary TOS page.

fyaconiello
User
Posts: 9
Joined: Tue Jun 19, 2012 10:15 am

Re: AUTH Redirect URL incorrect

Post by fyaconiello » Fri Jul 19, 2013 2:57 pm

When i go to the Login page in a browser and try to accept the TOS, a javascript error occurs which causes me to be unable to continue forward.
Screen Shot 2013-07-19 at 11.41.00 AM.png
screenshot of BH failure
Screen Shot 2013-07-19 at 11.41.00 AM.png (118.33 KiB) Viewed 14277 times

ghempton
User
Posts: 4
Joined: Sat Jan 11, 2014 4:47 pm

Re: AUTH Redirect URL incorrect

Post by ghempton » Sat Jan 11, 2014 4:49 pm

I am having this exact issue. Did you ever come up with a solution?

ghempton
User
Posts: 4
Joined: Sat Jan 11, 2014 4:47 pm

Re: AUTH Redirect URL incorrect

Post by ghempton » Wed Jan 15, 2014 7:56 pm

In our case, it turned out that this obscure page was being shown to us due to the wrong password being specified.

Post Reply