Forum for users and developers of Bullhorn's API service.
Moderators: StaffingSupport , s.emmons , BullhornSupport
kelleymedica
User
Posts: 3 Joined: Fri Oct 30, 2020 3:30 pm
Post
by kelleymedica » Fri Oct 30, 2020 3:35 pm
Hi; I'm receiving a 401 invalid token error when I request a ClientCorporation by ID immediately after a successful auth with a brand new BhRestToken and Rest URL (rest url is always the same). Unsure if I need a different swim lane or something else I'm not seeing?
After successful auth, this is the URL I'm requesting: https://rest{{swim_lane}}.bullhornstaffing.com/rest-services/{{corp_token}}/entity/ClientCorporation/{{client_id}}?BhRestToken={{bh_rest_token}}?fields=*
Error message:
Code: Select all
{
"errorMessageKey": "errors.authentication.invalidRestToken",
"origin": "proxy",
"errorCode": 401,
"errorMessage": "Bad 'BhRestToken' or timed-out."
}
Any help is greatly appreciated!
rabbey
User
Posts: 5 Joined: Thu Oct 22, 2020 8:46 pm
Post
by rabbey » Fri Oct 30, 2020 8:39 pm
If you're following this set of handshakes...
Code: Select all
https://auth.bullhornstaffing.com/oauth/authorize?client_id={{client_id}}&response_type=code&action=Login&username={{userid}}&password={{pwd}}&state={{state_code}}
(returns auth_code)
Code: Select all
https://auth.bullhornstaffing.com/oauth/token?grant_type=authorization_code&code={{auth_code}}&client_id={{client_id}}&client_secret={{client_secret}}
(returns access_token)
Code: Select all
https://rest.bullhornstaffing.com/rest-services/login?version=*&access_token={{access_token}}
(returns BhRestToken and restUrl)
It is the returned restUrl you should use for the root Url of subsequent requests.
Having said all that, your issue might simply be because you have two
? in your query string.
https://rest{{swim_lane}}.bullhornstaffing.com/rest-services/{{corp_token}}/entity/ClientCorporation/{{client_id}}
? BhRestToken={{bh_rest_token}}
? fields=*
Your request should be
Code: Select all
{{restUrl}}/entity/ClientCorporation/{{client_id}}?fields=*&BhRestToken={{BhRestToken}}
kelleymedica
User
Posts: 3 Joined: Fri Oct 30, 2020 3:30 pm
Post
by kelleymedica » Sun Nov 01, 2020 10:28 am
Omg; it was the extra question mark. So helpful to have another set of eyes sometimes; thank you!!