How to authenticate without pre-knowing the shop identifier

How to authenticate without pre-knowing the shop identifier

hassan1991
Shopify Partner
2 0 0

Hello, I am creating a middleware application, the application main job is to sync between two parties, Shopify & a multi tenant ERP system.

 

The application should be available for the ERP users to import Shopify orders to ERP system and to export the ERP items/products to Shopify.

 

All is good up to this point, the issue is that how to start the OAuth flow without pre define the shop name which is required in this case, I am using the official PHP SDK and according to this example the auth flow requires a shop domain name.

 

My question is, is there a way to redirect the user to a something like admin.shopify.com to authenticate & authorize the app scopes and do the auth flow?

Reply 1 (1)
hassan1991
Shopify Partner
2 0 0

Hello @Saheedfly21, thank you for your reply. Actually, yes, I replaced the shop domain by the mentioned URL, and it works like a charm. But this will throw a lot of exception when it comes to use the PHP SDK - I looked over the JS SDK, and it shares the same issue too btw -, do you have any idea to come over it? I already did some workarounds like inheriting the OAuth class with no luck, because the OAuth class itself requires the shop name as a required parameter. To tackle this, I had to update the package and publish it as a custom package in a private repo, but of course this is not the right thing. I am thinking to push my work as a PR to the PHP SDK team when I have some extra time for this, but meanwhile, I need to know if this is the only doable solution.

 

Best regards.