Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always register webhooks with offline sessions #1788

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

paulomarg
Copy link
Contributor

@paulomarg paulomarg commented Feb 8, 2024

What this PR does

Fixes #1708

Currently, we use the session we just created in the OAuth callback to trigger webhook registration. When using online tokens, that registration might not kick in before the token has expired.

To solve that, we can register webhooks using offline tokens, which won't expire.

Reviewer's guide to testing

  • Install an app in a store, but don't run the webhook manager job
  • Alter the user access token in the database
  • Perform the job

Before this change, that would break. Now, it should work the same way.

Things to focus on

  1. Does this have any impact on performance?
  2. Is it enough?

Checklist

Before submitting the PR, please consider if any of the following are needed:

  • Update CHANGELOG.md if the changes would impact users

@paulomarg paulomarg requested a review from a team as a code owner February 8, 2024 21:01
@paulomarg paulomarg force-pushed the register_webhooks_with_offline_tokens branch from ce87d58 to 7b83b09 Compare February 8, 2024 21:02
Copy link
Contributor

@nelsonwittwer nelsonwittwer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great solution until declarative webhooks fixes it for good 😎

@paulomarg paulomarg force-pushed the register_webhooks_with_offline_tokens branch from 7b83b09 to e81bc92 Compare February 8, 2024 21:24
Copy link
Contributor

@sle-c sle-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments, overall LGTM

test/controllers/callback_controller_test.rb Outdated Show resolved Hide resolved
app/controllers/shopify_app/callback_controller.rb Outdated Show resolved Hide resolved
@paulomarg paulomarg force-pushed the register_webhooks_with_offline_tokens branch from a249323 to 60d1cf1 Compare February 9, 2024 14:04
@paulomarg paulomarg force-pushed the register_webhooks_with_offline_tokens branch from 60d1cf1 to 7cb554d Compare February 9, 2024 14:12
@paulomarg paulomarg merged commit 7ae9adf into main Feb 9, 2024
8 checks passed
@paulomarg paulomarg deleted the register_webhooks_with_offline_tokens branch February 9, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid API key or access token (unrecognized login or wrong password)
3 participants