-
Notifications
You must be signed in to change notification settings - Fork 147
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
Unify token exchange for app managament client #5339
base: main
Are you sure you want to change the base?
Unify token exchange for app managament client #5339
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report
Show files with reduced coverage 🔻
Test suite run success2037 tests passing in 910 suites. Report generated by 🧪jest coverage report action from 2a032b1 |
31782b2
to
f90616c
Compare
f90616c
to
ddad615
Compare
ddad615
to
ec9bac7
Compare
We detected some changes at packages/*/src and there are no updates in the .changeset. |
packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts
Outdated
Show resolved
Hide resolved
packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts
Outdated
Show resolved
Hide resolved
packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts
Show resolved
Hide resolved
0cdb3fa
to
2a032b1
Compare
Differences in type declarationsWe 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:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/session.d.ts@@ -26,14 +26,16 @@ export declare function ensureAuthenticatedPartners(scopes?: PartnersAPIScope[],
/**
* Ensure that we have a valid session to access the App Management API.
*
- * @param scopes - Optional array of extra scopes to authenticate with.
- * @param env - Optional environment variables to use.
* @param options - Optional extra options to use.
+ * @param appManagementScopes - Optional array of extra scopes to authenticate with.
+ * @param businessPlatformScopes - Optional array of extra scopes to authenticate with.
+ * @param env - Optional environment variables to use.
* @returns The access token for the App Management API.
*/
-export declare function ensureAuthenticatedAppManagement(scopes?: AppManagementAPIScope[], env?: NodeJS.ProcessEnv, options?: EnsureAuthenticatedAdditionalOptions): Promise<{
- token: string;
+export declare function ensureAuthenticatedAppManagementAndBusinessPlatform(options?: EnsureAuthenticatedAdditionalOptions, appManagementScopes?: AppManagementAPIScope[], businessPlatformScopes?: BusinessPlatformScope[], env?: NodeJS.ProcessEnv): Promise<{
+ appManagementToken: string;
userId: string;
+ businessPlatformToken: string;
}>;
/**
* Ensure that we have a valid session to access the Storefront API.
|
WHY are these changes introduced?
Consolidates authentication flows for App Management and Business Platform APIs into a single function call, reducing duplicate authentication requests and improving performance.
Previously, by having two different calls to authenticate (1 for BP and 1 for AppManagement) we were triggering the whole identity token validation flow twice, now only once.
✅ This change saves up to 0.5 seconds on each command.
WHAT is this pull request doing?
ensureAuthenticatedAppManagementAndBusinessPlatform
function that handles authentication for both APIs simultaneouslyAppManagementClient
to use the new consolidated authentication methodHow to test your changes?
pnpm shopify auth logout
)If you want to dig further, you can run in debug and stop at the "token introspection" function. See that it should only run that once per command and not twice as it is now.
Measuring impact
Checklist