File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,24 @@ function (\stdClass $row): string {
376
376
explode (', ' , Config::get ('shopify-app.api_scopes ' ))
377
377
);
378
378
379
+ $ customValidator = Config::get ('shopify-app.api_scopes_validator ' );
380
+ if (is_array ($ customValidator ) && class_exists ($ customValidator [0 ])) {
381
+ $ class = app ($ customValidator [0 ]);
382
+ if (method_exists ($ class , $ customValidator [1 ])) {
383
+ $ ok = call_user_func_array (
384
+ [$ class , $ customValidator [1 ]],
385
+ [$ shop , $ scopes_actual ]
386
+ );
387
+ if ($ ok ) {
388
+ return null ;
389
+ }
390
+ return Redirect::route (
391
+ 'authenticate ' ,
392
+ ['shop ' => $ shop ->shopify_domain ]
393
+ );
394
+ }
395
+ }
396
+
379
397
if (empty (array_diff ($ scopes_required , $ scopes_actual ))) {
380
398
return null ;
381
399
}
Original file line number Diff line number Diff line change 161
161
*/
162
162
'api_scopes_validation ' => (bool ) env ('SHOPIFY_API_SCOPES_VALIDATION ' , true ),
163
163
164
+ /*
165
+ * Custom scopes validation
166
+ *
167
+ * Correct value: [\App\Services\Shop::class, 'checkScopes']
168
+ *
169
+ * Expected method signature: public function checkScopes(\App\Models\Shop $shop, array $scopesActual): bool
170
+ */
171
+ 'api_scopes_validator ' => null ,
172
+
164
173
/*
165
174
|--------------------------------------------------------------------------
166
175
| Shopify API Grant Mode
You can’t perform that action at this time.
0 commit comments