Skip to content

Commit

Permalink
Deprecate apiSecretKey being the access token for custom app
Browse files Browse the repository at this point in the history
  • Loading branch information
sle-c committed Nov 21, 2024
1 parent 709efd0 commit ca4791a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .changeset/clever-taxis-retire.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
'@shopify/shopify-api': patch
---

[bugfix] Makes GQL client behavior on customn app config consistent with REST client
[deprecation] Removes conditional check for `adminApiAccessToken` in REST client, deprecates `apiSecretKey` in favor of `adminApiAccessToken`
[bugfix] Makes GQL client behavior on custom app config consistent with REST client
[chore] Removes the warning about `adminApiAccessToken` and `apiSecretKey` being the same
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,12 @@ export class GraphqlClient {
logger(config).debug(message);
}

const customStoreAppAccessToken =
config.adminApiAccessToken ?? config.apiSecretKey;

this.session = params.session;
this.apiVersion = params.apiVersion;

this.client = createAdminApiClient({
accessToken: config.isCustomStoreApp
? customStoreAppAccessToken
? config.adminApiAccessToken!
: this.session.accessToken!,
apiVersion: this.apiVersion ?? config.apiVersion,
storeDomain: this.session.shop,
Expand Down
5 changes: 1 addition & 4 deletions packages/apps/shopify-api/lib/clients/admin/rest/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,14 @@ export class RestClient {
logger(config).debug(message);
}

const customStoreAppAccessToken =
config.adminApiAccessToken ?? config.apiSecretKey;

this.session = session;
this.apiVersion = apiVersion ?? config.apiVersion;
this.client = createAdminRestApiClient({
scheme: config.hostScheme,
storeDomain: session.shop,
apiVersion: apiVersion ?? config.apiVersion,
accessToken: config.isCustomStoreApp
? customStoreAppAccessToken
? config.adminApiAccessToken!
: session.accessToken!,
customFetchApi: abstractFetch,
logger: clientLoggerFactory(config),
Expand Down
9 changes: 0 additions & 9 deletions packages/apps/shopify-api/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,6 @@ export function validateConfig<Params extends ConfigParams>(
future: future ?? config.future,
});

if (
config.isCustomStoreApp &&
params.adminApiAccessToken === params.apiSecretKey
) {
createLogger(config).warning(
"adminApiAccessToken is set to the same value as apiSecretKey. adminApiAccessToken should be set to the Admin API access token for custom store apps; apiSecretKey should be set to the custom store app's API secret key.",
);
}

return config;
}

Expand Down

0 comments on commit ca4791a

Please sign in to comment.