question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better comments in ShopifyAuthorizationService.IsValidMyShopifyUrl

See original GitHub issue

Problem

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:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nozzlegearcommented, Jul 3, 2017

Renamed to IsValidShopDomainAsync in c982781.

0reactions
nozzlegearcommented, Jul 3, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found