1
0
Fork 0

added code to handle token refresh jobs specific to services

Dieser Commit ist enthalten in:
Robert Barrow 2019-05-19 14:56:17 +01:00
Ursprung 3aeb6a3b47
Commit 52b8c229ba
2 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,7 @@
module Jobs
class RefreshAPIAccessToken < Jobs::Base
class RefreshApiAccessToken < Jobs::Base
def execute(args)
CustomWizard::Authorization.refresh_access_token
CustomWizard::Authorization.refresh_access_token(args[:service])
end
end
end

Datei anzeigen

@ -121,7 +121,7 @@ class CustomWizard::Authorization
def self.refresh_access_token(service)
body = {
grant_type: 'refresh_token',
refresh_token: CustomWizard::Authorization.refresh_token
refresh_token: CustomWizard::Authorization.refresh_token(service)
}
authorization_string = CustomWizard::Authorization.client_id(service) + ':' + CustomWizard::Authorization.client_secret(service)
@ -146,7 +146,11 @@ class CustomWizard::Authorization
expires_at = Time.now + data['expires_in'].seconds
refresh_at = expires_at.to_time - 2.hours
Jobs.enqueue_at(refresh_at, :refresh_api_access_token)
opts = {
service: service
}
Jobs.enqueue_at(refresh_at, :refresh_api_access_token, opts)
CustomWizard::Authorization.set_access_token(
service: service,