You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and an example of including it for a Hubspot OAuth integration:
classOauth::HubspotAccount < ApplicationRecordincludeOauth::HubspotAccounts::BaseincludeOauth::Refreshable# maybe this should be in the concern?defcredentialsdata.dig('credentials')endend
Using the refresh_oauth2_access_token method, this example happens in Integrations::HubspotInstallation:
classIntegrations::HubspotInstallation < ApplicationRecordincludeIntegrations::HubspotInstallations::Basedefcredentialsoauth_hubspot_account.credentialsenddefmy_integration_requestifcredentials['expires'] && (Time.now >= Time.at(credentials['expires_at']))oauth_hubspot_account.refresh_oauth2_access_tokenend# make a request to the integration provider with your updated `credentials` objectendend
And finally, @gazayas's take on a potentially adding this to the core repo:
If anything, I could see it being implemented with a flag as an option when super scaffolding since we'd be defining methods, etc.
The text was updated successfully, but these errors were encountered:
There have been some questions and discussion around implementing an OAuth token refresh mechanism. In my project I ended up implementing a concern that allows the user to refresh the OAuth token on demand, but not automatically:
and an example of including it for a Hubspot OAuth integration:
Using the
refresh_oauth2_access_token
method, this example happens inIntegrations::HubspotInstallation
:And finally, @gazayas's take on a potentially adding this to the core repo:
The text was updated successfully, but these errors were encountered: