-
Notifications
You must be signed in to change notification settings - Fork 699
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
Localhost by default - remove https://
assumption throughout codebase
#1518
Conversation
https://
assumption throughout codebase
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 think a few of these could stay as https
(anything that points to a Shopify address and not host_name
).
It'll still work because I'm pretty sure Shopify will go http => https, but we can reduce the number of redirects by going straight to https when hitting Shopify.
@@ -18,7 +18,7 @@ | |||
|
|||
<%= javascript_include_tag('shopify_app/top_level', crossorigin: 'anonymous', integrity: true) %> | |||
</head> | |||
<body data-api-key="<%= ShopifyApp.configuration.api_key %>" data-shop-origin="https://<%= @shop %>" data-host="<%= @host %>" data-redirect-url="<%= @url %>"> | |||
<body data-api-key="<%= ShopifyApp.configuration.api_key %>" data-shop-origin="<%= ShopifyAPI::Context.host_scheme + "://" + @shop %>" data-host="<%= @host %>" data-redirect-url="<%= @url %>"> |
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.
Perhaps we could have a method like ShopifyAPI::Context.uri_for_shop(shop)
to avoid awkward string manipulation in the view.
@@ -13,7 +13,7 @@ | |||
id: 'redirection-target', | |||
data: { | |||
target: { | |||
myshopifyUrl: "https://#{current_shopify_domain}", | |||
myshopifyUrl: ShopifyAPI::Context.host_scheme + "://" + current_shopify_domain, |
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.
Could we have a method like current_shopify_url
?
d5d1092
to
e77c569
Compare
@@ -38,7 +38,7 @@ Rails.application.config.after_initialize do | |||
api_key: ShopifyApp.configuration.api_key, | |||
api_secret_key: ShopifyApp.configuration.secret, | |||
api_version: ShopifyApp.configuration.api_version, | |||
host_name: URI(ENV.fetch('HOST', '')).host || '', | |||
host: ENV['HOST'], |
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.
Either this or Shopify/shopify-api-ruby#1017 is incorrect. host_name
is still required by the setup
function. I'm not sure if it should still be required or should be optional now. If it should be optional maybe there should be some error checking to ensure that host and host_name don't conflict?
…se (Shopify#1518) * use ShopifyAPI::Context.host instead of assume https:// * use host scheme correctly * use ShopifyAPI::Context.host instead of composition * restore domain_host pattern * always tls with current_shopify_domain * typo + revert to tls default with cookies * 12.0 shopify_api dependency * update 12.1.0 API * rubocop updates * docs, readme, and changelog for localhost
What this PR does
This PR will work in tandem with this PR in the ruby API. This will enable users to run
shopify_app
withlocalhost
instead of mandating a tunnel for OAuth redirects.This removes hard coded
https://
and uses theShopifyAPI::Context.host
and orShopifyAPI::Context.host_scheme
to build redirect links.Reviewer's guide to testing
Ensure any modified links still work as expected.
Checklist
Before submitting the PR, please consider if any of the following are needed:
CHANGELOG.md
if the changes would impact usersREADME.md
, if appropriate./docs
, if necessary