Hello,
When creating metaobject definitions, an app must ask the “write_metaobject_definitions” permission.
However, it is unclear if this permission is needed when using declarative data? Could this be clarified in the documentation?
Hello,
When creating metaobject definitions, an app must ask the “write_metaobject_definitions” permission.
However, it is unclear if this permission is needed when using declarative data? Could this be clarified in the documentation?
Seems to be the case.
Trying to use the new Shopify metaobject definitions in TOML with optional scopes:
https://shopify.dev/docs/apps/build/authentication-authorization/app-installation/manage-access-scopes#optional-scopes
[access_scopes]
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
scopes = "read_content,read_products,read_themes,write_content,write_themes"
optional_scopes = [ "read_customer_events", "write_pixels", "read_pixels","write_metaobject_definitions","read_metaobject_definitions"]
and then trying to use this TOML for adding metaobjects, and I get a permissions error for lacking 'write_metaobject_definitions" when trying to run the app npm run dev or deploy.
[metaobjects.app.custom_article]
name = "Custom Article"
access.admin = "merchant_read_write"
access.storefront = "public_read"
capabilities.publishable = true
[metaobjects.app.custom_article.fields.title]
name = "Title"
type = "single_line_text_field"
It seems like a bug - the TOML metaobjects properties don’t allow for optional_scopes permissions
We are taking a look!
Hi Patrick – you need to include those scopes, in this case write_metaobject_definitions in the regular, non-optional, scopes list.
Your declared definitions are put in place when the app is first installed, so the regular scopes are what controls this – your optional scopes haven’t yet been requested at that point. Optional scopes are for things where some shops might agree to them or some shops might not, which isn’t really the right model for automatically applied metaobject definitions.
If you really want that scope to be optional, then you’ll need to use the API for managing those definitions.