OAuth and webhooks when using Shopify CLI
These days Shopify is pushing the CLI hard esp. when you follow their dev guides. These changes allow you get get going with the CLI more quickly when using shopifex. (PR is in draft as I would like to get some feedback)
Key changes
- Optional webhook topic config: when using the CLI webhooks are managed out of the box
- OAuth flow: Shopify assumes the app to have a route at
/auth/callback(when usingautomatically_update_urls_on_dev)
I had trouble with the app not rendering (upon install) after the oauth flow had finished, I assume because it was embedded and required the app bridge redirect flow so I've made changes to account for that.
Looks really interesting at first glance. I will test it out in my own Shopify apps to see if there are any compatibility issues coming up. What was the rest of your setup in regards to using Shopify CLI alongside Shopifex?
What was the rest of your setup in regards to using Shopify CLI alongside Shopifex?
My folder structure basically is as seen here https://github.com/NexPB/phx-shopify-app-example
Important files are the Shopify cli config files generated by shopify app init:
- https://github.com/NexPB/phx-shopify-app-example/blob/master/shopify/shopify.app.toml
- https://github.com/NexPB/phx-shopify-app-example/blob/master/shopify/web/shopify.web.toml <- slightly modified to start a phoenix server
Afterwards I start the my local env using shopify app dev, does some Shopify stuff like setting up a cloudflare proxy and starting the phoenix app. The cli sets certain env vars which make it easy to configure your phoenix app using runtime.exs.
Hope that answers your question.
That's really interesting! So you have your dev server running with shopify app dev and it takes care of updating the tunnel URLs on your development app and starts the phoenix dev server? This is a lot cleaner than what I've been doing all these years. To be honest I haven't looked at the Shopify CLI much since I figured it wouldn't work with my Phoenix stack.
I will review this more thoroughly soon, but this will definitely justify an update to the readme for this library.
That's really interesting! So you have your dev server running with shopify app dev and it takes care of updating the tunnel URLs on your development app and starts the phoenix dev server?
Yeah makes things pretty seamless
but this will definitely justify an update to the readme for this library
I'll try adding that to the PR this weekend
@ericdude4 I've added a section for the Shopify CLI at the end of the README
There are a few places in the codebase where we mention deprecating things when updating to version 3.x. I wonder if we take this opportunity to release a new 3.x version of shopifex as a release candidate. I happen to be just starting to build a new app with Shopifex, so it would be a great way to test too.
There are a few places in the codebase where we mention deprecating things when updating to version 3.x. I wonder if we take this opportunity to release a new 3.x version of shopifex as a release candidate. I happen to be just starting to build a new app with Shopifex, so it would be a great way to test too.
I did notice some changes that would benefit a 3.x release such as using some newer http libraries (I'm quite fond of tesla myself) instead of httpoison, I also noticed we pull in the neuron dep for a single graphql call I think this dep could ship with it's own simple client.
There are a few places in the codebase where we mention deprecating things when updating to version 3.x. I wonder if we take this opportunity to release a new 3.x version of shopifex as a release candidate. I happen to be just starting to build a new app with Shopifex, so it would be a great way to test too.
I did notice some changes that would benefit a 3.x release such as using some newer http libraries (I'm quite fond of
teslamyself) instead ofhttpoison, I also noticed we pull in theneurondep for a single graphql call I think this dep could ship with it's own simple client.
@NexPB I think a 3.x release is a fantastic idea. I really appreciate your willingness to help with this!
I wonder if we create a Shopifex.HTTPClientBehaviour (get, post, delete, etc) then ship the library with a tesla implementation Shopifex.HTTPClient.Tesla. This would allow it to be mocked with mox more easily also allow someone to create another implementation with their own HTTP client library-of-choice. Have you seen this pattern in practice before?
Do you have discord? Maybe we can continue the conversation there?
Do you have discord?
Yeah, my discord username is nexpb
Following these changes. @NexPB your sample repo is quite helpful!
Has anyone been using things with the Phoenix 1.8 RCs?
Has anyone been using things with the Phoenix 1.8 RCs?
Have only been using this with 1.7
What's the state of this? Will it get merged?