-
Notifications
You must be signed in to change notification settings - Fork 5
Next #600
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
base: main
Are you sure you want to change the base?
Conversation
…min-auth-plug fix broken app installation, we need to redirect to shopify for install
- moved to using a body reader for validation - ensure validation moved in to its own plug - all the logic for settings assigns (shop, topic, etc) moved in to its own plug - setup of the route for the webhooks should now happen in the router.ex - handling and business logic for webhooks should now happen in a controller
refactored webhooks
@@ -0,0 +1,22 @@ | |||
defmodule ShopifyAPI.Model.WebhookScope do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Shopify use the term scope
to refer to webhooks anywhere? Just curious how you landed on this struct name.
All I could find in Shopify's docs is that the headers contain "webhook metadata". https://shopify.dev/docs/apps/build/webhooks#headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Shopify does but Phoenix is standardizing on this now https://hexdocs.pm/phoenix/1.8.0-rc.2/scopes.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are using it as a way to build up a map of metadata for queries/access/etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this could just be called Scope, but I worry a bit that the app using the library might already be using that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nice, makes sense!
This allows us to use the shopify app toml for creating the App struct
adding a few fields to the App struct and a App.new/1
This uses the now commonly accepted pattern of passing down a scope to requests. The protocol defines how the data from the scope can be accessed. AuthToken has an implementation of the new protocol for backwards compatability reasons.
Add Scopes context and Scope protocol
This greatly simplifies the most common use case, 1 shopify app to one phx app.
new app server single app mode
This is the next big ver of shopify api