ShopifySharp icon indicating copy to clipboard operation
ShopifySharp copied to clipboard

Today I have issue with ShopifySharp.AuthorizationService.IsAuthenticRequest

Open BorisDNK opened this issue 3 years ago • 7 comments

I have couple of Proxy Apps. Today they stopped return true by ShopifySharp.AuthorizationService.IsAuthenticProxyRequest. But I didn't change code more then one year. Do any one have the same problem?

BorisDNK avatar Jul 13 '22 16:07 BorisDNK

Yes me too! I tried logging and signatures are not matching out of the blue! I have issue with IsAuthenticProxyRequest

KishanSlashDot avatar Jul 14 '22 05:07 KishanSlashDot

I have found the problem. Shopify added parameter logged_in_customer_id for Proxy Apps. If customer is not login in shop, logged_in_customer_id is empty, and method ParseRawQuerystring delete it from dictionary. Thats why signature not equal signature in URL from Shopify

BorisDNK avatar Jul 14 '22 09:07 BorisDNK

@BorisDNK Did you find any solution? Is it working for you now?

KishanSlashDot avatar Jul 14 '22 09:07 KishanSlashDot

Yes, I'm testing it now

BorisDNK avatar Jul 14 '22 10:07 BorisDNK

@BorisDNK Okay, If you can share the solution here then it would be helpful for us as well. Thank you in advance.

KishanSlashDot avatar Jul 14 '22 11:07 KishanSlashDot

Solutions is using overloaded methods with Dictinary<string, string>

var queryParams = Request.Query.ToDictionary(keySelector: m => m.Key.ToString(), elementSelector: m => m.Value.ToString());
ShopifySharp.AuthorizationService.IsAuthenticRequest(queryParams, SecretKey);

//and for this method to
ShopifySharp.AuthorizationService.IsAuthenticProxyRequest(queryParams, SecretKey)

But the better way fix value for _querystringRegex in AuthorizationService.ParseRawQuerystring But I cannot quick solve it )

BorisDNK avatar Jul 14 '22 11:07 BorisDNK

@BorisDNK Thanks for posting the workaround! I'll take a look at fixing the regex.

nozzlegear avatar Aug 08 '22 19:08 nozzlegear

Fixed in 5.18.2 on nuget!

nozzlegear avatar Aug 30 '22 20:08 nozzlegear