Skip to content

Identification for partner or dev dash orgs #5622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: zl/add_cli_token_support_for_app_management_and_bp_api
Choose a base branch
from

Conversation

zzooeeyy
Copy link
Contributor

@zzooeeyy zzooeeyy commented Apr 8, 2025

Figma

WHY are these changes introduced?

Fixes #0000

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

zzooeeyy commented Apr 8, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 9486042 to 92f9d10 Compare April 8, 2025 19:28
@zzooeeyy zzooeeyy changed the base branch from zl/add_cli_token_support_for_app_management_and_bp_api to zl/get_account_info_from_client April 8, 2025 19:28
@zzooeeyy zzooeeyy mentioned this pull request Apr 8, 2025
5 tasks
Copy link
Contributor

github-actions bot commented Apr 8, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
76.68% (+0.01% 🔼)
9491/12378
🟡 Branches
71.75% (+0.02% 🔼)
4656/6489
🟡 Functions
76.45% (+0.01% 🔼)
2461/3219
🟡 Lines
77.21% (+0.01% 🔼)
8976/11625

Test suite run success

2213 tests passing in 961 suites.

Report generated by 🧪jest coverage report action from 9c7aa7c

@zzooeeyy zzooeeyy force-pushed the zl/get_account_info_from_client branch from 74503b1 to b5863b9 Compare April 8, 2025 20:35
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 92f9d10 to 5b26dbb Compare April 8, 2025 20:35
@zzooeeyy zzooeeyy force-pushed the zl/get_account_info_from_client branch from b5863b9 to 26ee75a Compare April 9, 2025 15:38
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch 2 times, most recently from 23ea852 to 92b0424 Compare April 9, 2025 16:44
@zzooeeyy zzooeeyy changed the base branch from zl/get_account_info_from_client to zl/add_cli_token_support_for_app_management_and_bp_api April 9, 2025 16:44
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 06c54fd to 7692bd1 Compare April 9, 2025 17:15
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch 2 times, most recently from 8fb695f to fc65f64 Compare April 9, 2025 17:30
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 7692bd1 to a437d4f Compare April 9, 2025 19:00
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch 2 times, most recently from 87b2088 to 42273aa Compare April 9, 2025 19:06
@zzooeeyy zzooeeyy mentioned this pull request Apr 9, 2025
5 tasks
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from a437d4f to 21a2f26 Compare April 9, 2025 19:48
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 42273aa to a3144a0 Compare April 9, 2025 19:48
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 21a2f26 to 87d5eda Compare April 9, 2025 22:49
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from a3144a0 to d138af7 Compare April 9, 2025 22:49
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 87d5eda to 1093c77 Compare April 10, 2025 14:58
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from d138af7 to 2309d2c Compare April 10, 2025 14:58
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 1093c77 to a0d5b24 Compare April 10, 2025 17:30
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 2309d2c to 2ea27c2 Compare April 10, 2025 17:30
@@ -339,7 +339,7 @@ export class AppManagementClient implements DeveloperPlatformClient {
if (!organizationsResult.currentUserAccount) return []
return organizationsResult.currentUserAccount.organizations.nodes.map((org) => ({
id: idFromEncodedGid(org.id),
businessName: org.name,
businessName: `${org.name} (Dev Dashboard)`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably confirm with Nick about namings here before merging

@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from a0d5b24 to 0ed3137 Compare April 14, 2025 20:58
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 2ea27c2 to 2f129c9 Compare April 14, 2025 20:58
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 0ed3137 to e6b204f Compare April 14, 2025 21:55
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 2f129c9 to 9f89efd Compare April 14, 2025 21:55
@zzooeeyy
Copy link
Contributor Author

/snapit

Copy link
Contributor

🫰✨ Thanks @zzooeeyy! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from e6b204f to 6163dea Compare April 14, 2025 23:09
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 9f89efd to 91cb4d9 Compare April 14, 2025 23:09
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 6163dea to 4d86540 Compare April 21, 2025 20:29
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from 91cb4d9 to d1d499a Compare April 21, 2025 20:29
@zzooeeyy zzooeeyy force-pushed the zl/identification_for_partner_or_dev_dash_orgs branch from d1d499a to 9c7aa7c Compare April 21, 2025 21:15
@zzooeeyy zzooeeyy force-pushed the zl/add_cli_token_support_for_app_management_and_bp_api branch from 4d86540 to ad547ab Compare April 21, 2025 21:15
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/session/exchange.d.ts
@@ -26,15 +26,33 @@ export declare function exchangeAccessForApplicationTokens(identityToken: Identi
  */
 export declare function refreshAccessToken(currentToken: IdentityToken): Promise<IdentityToken>;
 /**
- * Given a custom CLI token passed as ENV variable, request a valid partners API token
+ * Given a custom CLI token passed as ENV variable, request a valid Partners API token
  * This token does not accept extra scopes, just the cli one.
- * @param token - The CLI token passed as ENV variable
+ * @param token - The CLI token passed as ENV variable 
  * @returns An instance with the application access tokens.
  */
 export declare function exchangeCustomPartnerToken(token: string): Promise<{
     accessToken: string;
     userId: string;
 }>;
+/**
+ * Given a custom CLI token passed as ENV variable, request a valid App Management API token
+ * @param token - The CLI token passed as ENV variable 
+ * @returns An instance with the application access tokens.
+ */
+export declare function exchangeCliTokenForAppManagementAccessToken(token: string): Promise<{
+    accessToken: string;
+    userId: string;
+}>;
+/**
+ * Given a custom CLI token passed as ENV variable, request a valid Business Platform API token
+ * @param token - The CLI token passed as ENV variable 
+ * @returns An instance with the application access tokens.
+ */
+export declare function exchangeCliTokenForBusinessPlatformAccessToken(token: string): Promise<{
+    accessToken: string;
+    userId: string;
+}>;
 type IdentityDeviceError = 'authorization_pending' | 'access_denied' | 'expired_token' | 'slow_down' | 'unknown_failure';
 /**
  * Given a deviceCode obtained after starting a device identity flow, request an identity token.
packages/cli-kit/dist/private/node/session/scopes.d.ts
@@ -13,4 +13,10 @@ export declare function allDefaultScopes(extraScopes?: string[]): string[];
  * @param extraScopes - custom user-defined scopes
  * @returns Array of scopes
  */
-export declare function apiScopes(api: API, extraScopes?: string[]): string[];
\ No newline at end of file
+export declare function apiScopes(api: API, extraScopes?: string[]): string[];
+/**
+ * Returns specific scopes required for token exchange with the given API.
+ * @param api - API to get the scopes for
+ * @returns Array of transformed scopes
+ */
+export declare function tokenExchangeScopes(api: API): string[];
\ No newline at end of file
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -25,13 +25,6 @@ export declare function isDevelopment(env?: NodeJS.ProcessEnv): boolean;
  * @returns True if SHOPIFY_FLAG_VERBOSE is truthy or the flag --verbose has been passed.
  */
 export declare function isVerbose(env?: NodeJS.ProcessEnv): boolean;
-/**
- * It returns true if the App Management API is disabled.
- * This should only be relevant when using a Partners token.
- *
- * @returns True if the App Management API is disabled.
- */
-export declare function isAppManagementDisabled(): boolean;
 /**
  * Returns true if the environment in which the CLI is running is either
  * a local environment (where dev is present) or a cloud environment (spin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants