Page 1 of 1

Unable to get access code.

Posted: Wed Jan 15, 2020 5:33 pm
by gsabatino
Hi there.

I am new to APIs... so I apologize in advance if this is elementary...

I'm using PowerShell to just grab the list of user accounts. Just some pieces of info. I need to do this programmatically instead of logging in every few days to get the list.

If I run the command in the browser (substituted with the correct values), it works just fine, however if I do it via command in PS, it doesn't return anything valuable:

Code: Select all

Invoke-WebRequest "https://auth.bullhornstaffing.com/oauth/authorize?client_id=$clientid&response_type=code&action=Login&username=$APIUSERNAME&password=$APIPassword"
I am returned the following:

Code: Select all

StatusCode        : 200
StatusDescription : OK
Content           : <!DOCTYPE html>
                    <html lang="en-US">
                    <head>
                    <!--Optimizely Script -->
                    <!--<script src="https://cdn.optimizely.com/js/2026481316.js"></script>-->
                    <!-- Google Analytics-->
                     <!--<script async src='https:/...
RawContent        : HTTP/1.1 200 OK
                    Transfer-Encoding: chunked
                    Connection: keep-alive
                    Keep-Alive: timeout=20
                    Vary: Accept-Encoding,Accept-Encoding,Accept-Encoding,Cookie
                    Link: <https://www.bullhorn.com/wp-json/>; re...
Forms             : {mktoForm_2674, mktoForm_3061}
Headers           : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Keep-Alive, timeout=20], [Vary, Accept-Encoding,Accept-Encoding,Accept-Encoding,Cookie]...}
Images            : {@{innerHTML=; innerText=; outerHTML=<IMG style="MAX-WIDTH: 185px; MARGIN: 0px auto" src="https://www.bullhorn.com/wp-content/uploads/2019/05/Bullhorn_One_linear_light.png">; outerText=; 
                    tagName=IMG; style=MAX-WIDTH: 185px; MARGIN: 0px auto; src=https://www.bullhorn.com/wp-content/uploads/2019/05/Bullhorn_One_linear_light.png}, @{innerHTML=; innerText=; outerHTML=<IMG 
                    src="/wp-content/uploads/2018/10/Product__Applicant-TrackingCRM.png">; outerText=; tagName=IMG; src=/wp-content/uploads/2018/10/Product__Applicant-TrackingCRM.png}, @{innerHTML=; innerText=; 
                    outerHTML=<IMG src="/wp-content/uploads/2018/10/Product__Onboarding.png">; outerText=; tagName=IMG; src=/wp-content/uploads/2018/10/Product__Onboarding.png}, @{innerHTML=; innerText=; 
                    outerHTML=<IMG src="https://www.bullhorn.com/wp-content/uploads/2018/10/Product__4Salesforce.png">; outerText=; tagName=IMG; 
                    src=https://www.bullhorn.com/wp-content/uploads/2018/10/Product__4Salesforce.png}...}
InputFields       : {}
Links             : {@{innerHTML=Chrome; innerText=Chrome; outerHTML=<A href="https://support.google.com/chrome/answer/95346?hl=en">Chrome</A>; outerText=Chrome; tagName=A; 
                    href=https://support.google.com/chrome/answer/95346?hl=en}, @{innerHTML=Contact; innerText=Contact; outerHTML=<A class=btn href="/contact/">Contact</A>; outerText=Contact; tagName=A; class=btn; 
                    href=/contact/}, @{innerHTML=; innerText=; outerHTML=<A class=navbar-brand href="https://www.bullhorn.com"></A>; outerText=; tagName=A; class=navbar-brand; href=https://www.bullhorn.com}, 
                    @{innerHTML=Products; innerText=Products; outerHTML=<A href="#">Products</A>; outerText=Products; tagName=A; href=#}...}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 167156
When using a browser, I'm prompted for an accept screen. If I do, I get redirected to another page, but the URL shows the code=, which I assume is followed by the authorization code, which is then used to obtain the OAUTH key.

Can anyone point me in the right direction?