mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 08:54:23 -05:00
Merge branch 'master' of https://github.com/rickbarrette/redmine_qbo
This commit is contained in:
@@ -21,7 +21,7 @@ module QuickbooksOauth
|
|||||||
begin
|
begin
|
||||||
yield oauth_access_token
|
yield oauth_access_token
|
||||||
rescue OAuth2::Error, Quickbooks::AuthorizationFailure => ex
|
rescue OAuth2::Error, Quickbooks::AuthorizationFailure => ex
|
||||||
Rails.logger.info("QuickbooksOauth.perform: #{ex.message}")
|
Rails.logger.error("QuickbooksOauth.perform: #{ex.message}")
|
||||||
|
|
||||||
# to prevent an infinite loop here keep a counter and bail out after N times...
|
# to prevent an infinite loop here keep a counter and bail out after N times...
|
||||||
attempts += 1
|
attempts += 1
|
||||||
@@ -36,6 +36,7 @@ module QuickbooksOauth
|
|||||||
end
|
end
|
||||||
|
|
||||||
def refresh_token!
|
def refresh_token!
|
||||||
|
Rails.logger.info("QuickbooksOauth.refresh_token!")
|
||||||
t = oauth_access_token
|
t = oauth_access_token
|
||||||
refreshed = t.refresh!
|
refreshed = t.refresh!
|
||||||
|
|
||||||
@@ -45,6 +46,8 @@ module QuickbooksOauth
|
|||||||
oauth2_refresh_token_expires_at = 100.days.from_now
|
oauth2_refresh_token_expires_at = 100.days.from_now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Rails.logger.info("QuickbooksOauth.refresh_token!: #{oauth2_refresh_token_expires_at}")
|
||||||
|
|
||||||
update!(
|
update!(
|
||||||
oauth2_access_token: refreshed.token,
|
oauth2_access_token: refreshed.token,
|
||||||
oauth2_access_token_expires_at: Time.at(refreshed.expires_at),
|
oauth2_access_token_expires_at: Time.at(refreshed.expires_at),
|
||||||
|
|||||||
Reference in New Issue
Block a user