To set scopes for your Shopify app developed with Laravel, you need to:
config/shopify-app.php
file to include the required scope. For example, to include the write_price_rules
scope, add the following line of code to the scopes
array: 'write_price_rules',
config/shopify-auth.php
file to include the scope within the options
array. For example,'options' => [
'grant_options' => [
'write_price_rules',
],
],
routes/web.php
or routes/api.php
file to include the specific route that requires the write_price_rules
scope, and then add a middleware to check that the authenticated user has the required scope. For example,Route::post('/create-price-rule', 'PriceRuleController@store')->middleware(['auth.shop', 'scopes:write_price_rules']);
Once you have made these updates, you should submit your app for merchant approval, and ensure that the write_price_rules
scope is clearly explained and justified in your app's documentation and usage instructions.
Asked: 2022-01-27 11:00:00 +0000
Seen: 11 times
Last updated: Apr 19 '22