pbearne / Bullhorn2WP

fixed version of the Bullhorn2WP plugin
5 stars 11 forks source link

Exception while logging into Bullhorn API after upgrade #12

Open siparsons opened 7 years ago

siparsons commented 7 years ago

First off - Great plugin. Its saved me loads of time.

I have recently upgraded from 2.4 to 2.5. I did this by deactivating the old plugin, installing the new one (to a slightly different plugin folder name) and then activated the new one.

I then reconnected to bullhorn through the settings page, clicked save and then hit the sync now button.

I then got an exception saying "There was a problem logging into the Bullhorn API."

It was sinking absolutely fine with 2.4

After trying various things I restarted the server, and now it all seems to be working fine.

Can you think of a reason why restarting the server may have fixed the login issue, only I am not sure I will have this ability when I upgrade the clients site (I am using my own WP installation to test the upgrade)

Thanks in advance.

siparsons commented 7 years ago

The full error:

Fatal error: Uncaught exception 'Exception' with message 'There was a problem logging into the Bullhorn API.' in D:\home\site\wwwroot\wp-content\plugins\bh-staffing-job-listing-and-cv-upload-for-wp2\bullhorn.php:67 Stack trace: #0 D:\home\site\wwwroot\wp-content\plugins\bh-staffing-job-listing-and-cv-upload-for-wp2\cron.php(40): Bullhorn_Connection::sync() #1 [internal function]: bullhorn_sync_now('') #2 D:\home\site\wwwroot\wp-includes\class-wp-hook.php(298): call_user_func_array('bullhorn_sync_n...', Array) #3 D:\home\site\wwwroot\wp-includes\class-wp-hook.php(323): WP_Hook->apply_filters('', Array) #4 D:\home\site\wwwroot\wp-includes\plugin.php(453): WP_Hook->do_action(Array) #5 D:\home\site\wwwroot\wp-admin\admin.php(154): do_action('admin_init') #6 D:\home\site\wwwroot\wp-admin\options-general.php(10): require_once('D:\\home\\site\\ww...') #7 {main} thrown in D:\home\site\wwwroot\wp-content\plugins\bh-staffing-job-listing-and-cv-upload-for-wp2\bullhorn.php on line 67
pbearne commented 7 years ago

I am not sure what is going on here

the login that failed dose write the error_log with the actual error

other wise if you have broken set I could debug it

we need to see what the bullhorn api returns at line 147 of bullhorn.php

Hope this helps

Paul

siparsons commented 7 years ago

I believe this is a continuation of the issues around keeping the token alive.

Is it possible to detect that there has been an issue using the current token and then attempt a login automatically?

pbearne commented 7 years ago

The problem is that we get single use refresh token and if that get messed you have to relogin via WP admin

One of the problem we are seeing with the API is that login server to API servers takes sometime so we can sometimes be quicker than Bullhorn so we pass a new token when Bullhorn is expecting the old one still.

I latest version of the code on github we added a pause into the code to allow bullhorn to sync before we make the next call are you run the new version?

Paul

siparsons commented 7 years ago

I am sure I have the latest version, but am still seeing the problem.

I read in the documentation that when each refresh token is used, the response back from the login server includes a new refresh token to use the next time..

If this being stored?

pbearne commented 7 years ago

yes we do store this

Pull new copy from here we have just made a lot changes

Paul