500 error trying to login after refreshing the access_token

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

spoissant
User
Posts: 5
Joined: Thu May 18, 2017 3:03 pm

500 error trying to login after refreshing the access_token

Postby spoissant » Wed Jun 28, 2017 9:57 am

I`m a developer working on a BH integration for a client and I`m running into some issues login after refreshing my access_token.

This is something that used to work perfectly a few days ago and now I keep running into 500 errors.

Here`s my situation (this is all done in Postman but I`m also getting similar issues when trying to run those steps from C#):
1) Get Authorization Code using OAuth2 login
2) Get initial AccessToken by calling

Code: Select all

https://auth.bullhornstaffing.com/oauth/token?grant_type=authorization_code&code={{CODE}}&client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}

3) Login by calling

Code: Select all

https://rest.bullhornstaffing.com/rest-services/login?version=*&access_token={{ACCESS_TOKEN}}

4) Do REST magic for a while
5) Refresh the access_token by calling

Code: Select all

https://auth.bullhornstaffing.com/oauth/token?grant_type=refresh_token&refresh_token={{REFRESH_TOKEN}}&client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}

6) Try to login again with the new access_token...

And the server returns something like that:

Code: Select all

<html>
    <head>
        <title>Apache Tomcat/7.0.27 - Error report</title>
        <style>
            <!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-->
        </style>
    </head>
    <body>
        <h1>HTTP Status 500 - </h1>
        <HR size="1" noshade="noshade">
        <p>
            <b>type</b> Exception report
        </p>
        <p>
            <b>message</b>
            <u></u>
        </p>
        <p>
            <b>description</b>
            <u>The server encountered an internal error () that prevented it from fulfilling this request.</u>
        </p>
        <p>
            <b>exception</b>
            <pre>org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: I/O Error: Connection reset
   org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
   org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:577)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
   org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:721)
   org.springframework.jdbc.core.JdbcTemplate.queryForMap(JdbcTemplate.java:740)
   org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForMap(SimpleJdbcTemplate.java:205)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:495)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:456)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:433)
   com.bullhorn.rest.handler.security.SecurityHandler.oauthLogin(SecurityHandler.java:442)
   com.bullhorn.rest.handler.security.SecurityHandler.login(SecurityHandler.java:366)
   com.bullhorn.rest.servlet.RestDispatcher.doDispatch(RestDispatcher.java:201)
   com.bullhorn.rest.servlet.RestDispatcher.dispatch(RestDispatcher.java:140)
   com.bullhorn.rest.servlet.RestServlet.service(RestServlet.java:35)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   com.bullhorn.common.servlet.CorsFilter.doFilter(CorsFilter.java:77)
</pre>
        </p>
        <p>
            <b>root cause</b>
            <pre>java.sql.SQLException: I/O Error: Connection reset
   net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1053)
   net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCore.java:899)
   net.sourceforge.jtds.jdbc.ConnectionJDBC2.setCatalog(ConnectionJDBC2.java:2282)
   org.apache.commons.dbcp.DelegatingConnection.setCatalog(DelegatingConnection.java:374)
   org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setCatalog(PoolingDataSource.java:333)
   com.bullhorn.common.db.BhDataSourceImpl.fixCatalog(BhDataSourceImpl.java:83)
   com.bullhorn.common.db.BhDataSourceImpl.getConnection(BhDataSourceImpl.java:102)
   org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
   org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
   org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:577)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
   org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:721)
   org.springframework.jdbc.core.JdbcTemplate.queryForMap(JdbcTemplate.java:740)
   org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForMap(SimpleJdbcTemplate.java:205)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:495)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:456)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:433)
   com.bullhorn.rest.handler.security.SecurityHandler.oauthLogin(SecurityHandler.java:442)
   com.bullhorn.rest.handler.security.SecurityHandler.login(SecurityHandler.java:366)
   com.bullhorn.rest.servlet.RestDispatcher.doDispatch(RestDispatcher.java:201)
   com.bullhorn.rest.servlet.RestDispatcher.dispatch(RestDispatcher.java:140)
   com.bullhorn.rest.servlet.RestServlet.service(RestServlet.java:35)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   com.bullhorn.common.servlet.CorsFilter.doFilter(CorsFilter.java:77)
</pre>
        </p>
        <p>
            <b>root cause</b>
            <pre>java.net.SocketException: Connection reset
   java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:96)
   java.net.SocketOutputStream.write(SocketOutputStream.java:136)
   java.io.DataOutputStream.write(DataOutputStream.java:90)
   net.sourceforge.jtds.jdbc.SharedSocket.sendNetPacket(SharedSocket.java:676)
   net.sourceforge.jtds.jdbc.RequestStream.putPacket(RequestStream.java:560)
   net.sourceforge.jtds.jdbc.RequestStream.flush(RequestStream.java:508)
   net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1040)
   net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCore.java:899)
   net.sourceforge.jtds.jdbc.ConnectionJDBC2.setCatalog(ConnectionJDBC2.java:2282)
   org.apache.commons.dbcp.DelegatingConnection.setCatalog(DelegatingConnection.java:374)
   org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setCatalog(PoolingDataSource.java:333)
   com.bullhorn.common.db.BhDataSourceImpl.fixCatalog(BhDataSourceImpl.java:83)
   com.bullhorn.common.db.BhDataSourceImpl.getConnection(BhDataSourceImpl.java:102)
   org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
   org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
   org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:577)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
   org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
   org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:721)
   org.springframework.jdbc.core.JdbcTemplate.queryForMap(JdbcTemplate.java:740)
   org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForMap(SimpleJdbcTemplate.java:205)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:495)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:456)
   com.bullhorn.rest.session.SessionManager.login(SessionManager.java:433)
   com.bullhorn.rest.handler.security.SecurityHandler.oauthLogin(SecurityHandler.java:442)
   com.bullhorn.rest.handler.security.SecurityHandler.login(SecurityHandler.java:366)
   com.bullhorn.rest.servlet.RestDispatcher.doDispatch(RestDispatcher.java:201)
   com.bullhorn.rest.servlet.RestDispatcher.dispatch(RestDispatcher.java:140)
   com.bullhorn.rest.servlet.RestServlet.service(RestServlet.java:35)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
   com.bullhorn.common.servlet.CorsFilter.doFilter(CorsFilter.java:77)
</pre>
        </p>
        <p>
            <b>note</b>
            <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.</u>
        </p>
        <HR size="1" noshade="noshade">
        <h3>Apache Tomcat/7.0.27</h3>
    </body>
</html>


Any idea?

spoissant
User
Posts: 5
Joined: Thu May 18, 2017 3:03 pm

Re: 500 error trying to login after refreshing the access_token

Postby spoissant » Wed Jun 28, 2017 10:18 am

I think I MIGHT have found the problem.

I used to do my /login call with a POST. Switched it to a GET and it started working. Not too sure if I was just lucky that it worked with POST in the past or if they updated something on their end...


Return to “REST API”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron