Skip to content

Commit

Permalink
Merge pull request #4245 from Shopify/zoey/add-required-scopes
Browse files Browse the repository at this point in the history
Add 'required_scopes' to 'access_scope' toml schema
  • Loading branch information
zzooeeyy authored Aug 5, 2024
2 parents dfc5d76 + 0ba29e0 commit 11e060f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-lobsters-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/app': minor
---

Add required_scopes to the app_access module
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('app_config_app_access', () => {
access_scopes: {
scopes: 'read_products,write_products',
optional_scopes: ['read_customers'],
required_scopes: ['write_orders', 'read_inventory'],
use_legacy_install_flow: true,
},
auth: {
Expand All @@ -31,6 +32,7 @@ describe('app_config_app_access', () => {
},
scopes: 'read_products,write_products',
optional_scopes: ['read_customers'],
required_scopes: ['write_orders', 'read_inventory'],
use_legacy_install_flow: true,
redirect_url_allowlist: ['https://example.com/auth/callback'],
})
Expand All @@ -46,6 +48,7 @@ describe('app_config_app_access', () => {
},
scopes: 'read_products,write_products',
optional_scopes: ['read_customers'],
required_scopes: ['write_orders', 'read_inventory'],
use_legacy_install_flow: true,
redirect_url_allowlist: ['https://example.com/auth/callback'],
}
Expand All @@ -62,6 +65,7 @@ describe('app_config_app_access', () => {
access_scopes: {
scopes: 'read_products,write_products',
optional_scopes: ['read_customers'],
required_scopes: ['write_orders', 'read_inventory'],
use_legacy_install_flow: true,
},
auth: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const AppAccessSchema = zod.object({
.string()
.transform((scopes) => normalizeDelimitedString(scopes) ?? '')
.optional(),
required_scopes: zod.array(zod.string()).optional(),
optional_scopes: zod.array(zod.string()).optional(),
use_legacy_install_flow: zod.boolean().optional(),
})
Expand All @@ -34,6 +35,7 @@ export const AppAccessSpecIdentifier = 'app_access'
const AppAccessTransformConfig: TransformationConfig = {
access: 'access',
scopes: 'access_scopes.scopes',
required_scopes: 'access_scopes.required_scopes',
optional_scopes: 'access_scopes.optional_scopes',
use_legacy_install_flow: 'access_scopes.use_legacy_install_flow',
redirect_url_allowlist: 'auth.redirect_urls',
Expand Down

0 comments on commit 11e060f

Please sign in to comment.