Skip to content

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Next #600

wants to merge 10 commits into from

Conversation

hez
Copy link
Collaborator

@hez hez commented Apr 22, 2025

This is the next big ver of shopify api

  • fix to auth plug
  • new webhooks workflow, new plug and controller!

hez added 4 commits April 11, 2025 10:18
…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
@@ -0,0 +1,22 @@
defmodule ShopifyAPI.Model.WebhookScope do
Copy link
Contributor

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, nice, makes sense!

hez and others added 6 commits May 3, 2025 08:25
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.
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.

3 participants