Skip to content

Commit bec1ab8

Browse files
committed
return an error when using themekit access password with theme profile
1 parent 48a844b commit bec1ab8

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

.changeset/short-items-see.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/theme': patch
3+
---
4+
5+
Return error when running theme profile using a themekit access password

packages/theme/src/cli/services/profile.test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,7 @@ describe('profile', () => {
128128
await expect(result).rejects.toThrow(
129129
new AbortError(
130130
'Unable to use Admin API tokens with the profile command',
131-
`To use this command with the --password flag you must:
132-
133-
1. Install the Theme Access app on your shop
134-
2. Generate a new password
135-
136-
Alternatively, you can authenticate normally by not passing the --password flag.
137-
138-
Learn more: https://shopify.dev/docs/storefronts/themes/tools/theme-access`,
131+
'You can authenticate normally by not passing the --password flag.',
139132
),
140133
)
141134
})

packages/theme/src/cli/services/profile.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,12 @@ export async function profile(
2222
? await ensureValidPassword(storefrontPassword, adminSession.storeFqdn)
2323
: undefined
2424

25-
if (themeAccessPassword?.startsWith('shpat_')) {
26-
throw new AbortError(
27-
'Unable to use Admin API tokens with the profile command',
28-
`To use this command with the --password flag you must:
29-
30-
1. Install the Theme Access app on your shop
31-
2. Generate a new password
25+
const isUnsupportedToken = ['shpat_', 'shptka_'].some((prefix) => themeAccessPassword?.startsWith(prefix))
3226

33-
Alternatively, you can authenticate normally by not passing the --password flag.
34-
35-
Learn more: https://shopify.dev/docs/storefronts/themes/tools/theme-access`,
27+
if (isUnsupportedToken) {
28+
throw new AbortError(
29+
'Unable to use Admin API tokens or Theme Access passwords with the profile command',
30+
'You can authenticate normally by not passing the --password flag.',
3631
)
3732
}
3833

0 commit comments

Comments
 (0)