Better comments in ShopifyAuthorizationService.IsValidMyShopifyUrl
See original GitHub issueProblem
The ShopifySharp.ShopifyAuthorizationService.IsValidMyShopifyUrl
should have some changes in the comments.
A developer calling this method can guess wrongly these points:
- There is no remote calls in the method so there is no performance or delay penalty
- The method can ensure 100% that the shop url is valid. (But a fake website can also return a X-ShopId in the header parameters, so the method IsValidMyShopifyUrl will return true).
The original comment is:
/// <summary>
/// A convenience function that tries to ensure that a given URL is a valid Shopify store by checking the response headers for X-ShopId.
/// </summary>
Solution
I propose to explain that the method actually make a request to the shop url. This is important because the caller of this method can know that will be a small time penalty becauseof the http request. And also explain about faking the headers.
This is just an example.
/// <summary>
/// A convenience function that tries to ensure that a given URL is a valid Shopify store by making a request to the shop url and checking the response headers for X-ShopId.
/// Take into account that a fake website could return the X-ShopId header.
/// </summary>
I would like to hear from you what do you think.
Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Using my custom domain for the checkout page when ...
Solved: Hello! I am just about to migrate out of Shopify themes, amazing as they are, and create my own website using a...
Read more >Solved: URL ERROR - Shopify Discussions
My online store url (domain) does not load on my customers' devices for some reason. When they try to load my domain name,...
Read more >How do I respond to comments on blog posts
At this time, the best way to reply to blog comments is to go directly onto your site from your URL and visit...
Read more >Solved: Using APIs from a different origin/domain
Using GraphQL or the REST API, is there a way to get the Shopify store to allow API requests from my separate domain...
Read more >Solved: "Termination of your Shopify Account"
We have been made aware that certain products being sold on your Shopify store, storename.myshopify.com, may not be authorized by the brand ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Renamed to
IsValidShopDomainAsync
in c982781.I’m working on pushing through the final changes for v4 right now, and after reviewing this again I think I’m going to go with your original suggestion to improve the documentation and rename the function to
IsValidMyShopifyUrlAsync
@ernestogutierrez.I liked your idea for pulling in the Shop’s
Shop
object to check its domain or myshopify domain property, but it didn’t occur to me at the time that we would need an access token to do so, at which point we already know that the URL must have been correct.I’ll make sure I add documentation to the current function that the domain could fake the shop id header.