From e929ba34c375acec914bbfd948de2624c4914dc4 Mon Sep 17 00:00:00 2001 From: Jonathan Foster Date: Wed, 10 Jul 2024 12:19:30 -0400 Subject: [PATCH] fix bad copy pasta --- src/SpotifyApi.ts | 21 +++++++++++++++------ src/auth/ClientCredentialsStrategy.ts | 7 +------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/SpotifyApi.ts b/src/SpotifyApi.ts index 5494c3b..451f083 100644 --- a/src/SpotifyApi.ts +++ b/src/SpotifyApi.ts @@ -200,14 +200,23 @@ export class SpotifyApi { public static withClientCredentials( clientId: string, clientSecret: string, - scopes: string[] = [], + config?: SdkOptions + ): SpotifyApi; + + /** @deprecated The scopes array is not used for client authorization. Remove the argument. */ + public static withClientCredentials( + clientId: string, + clientSecret: string, + config: SdkOptions, + scopes: string[] + ): SpotifyApi; + + public static withClientCredentials( + clientId: string, + clientSecret: string, config?: SdkOptions ): SpotifyApi { - const strategy = new ClientCredentialsStrategy( - clientId, - clientSecret, - scopes - ); + const strategy = new ClientCredentialsStrategy(clientId, clientSecret); return new SpotifyApi(strategy, config); } diff --git a/src/auth/ClientCredentialsStrategy.ts b/src/auth/ClientCredentialsStrategy.ts index aae60d5..4f37a6f 100644 --- a/src/auth/ClientCredentialsStrategy.ts +++ b/src/auth/ClientCredentialsStrategy.ts @@ -14,11 +14,7 @@ export default class ClientCredentialsStrategy implements IAuthStrategy { return this.configuration!.cachingStrategy; } - constructor( - private clientId: string, - private clientSecret: string, - private scopes: string[] = [] - ) {} + constructor(private clientId: string, private clientSecret: string) {} public setConfiguration(configuration: SdkConfiguration): void { this.configuration = configuration; @@ -54,7 +50,6 @@ export default class ClientCredentialsStrategy implements IAuthStrategy { private async getTokenFromApi(): Promise { const options = { grant_type: "client_credentials", - scope: this.scopes.join(" "), } as any; const bodyAsString = Object.keys(options)