Skip to content

Commit

Permalink
fix bad copy pasta
Browse files Browse the repository at this point in the history
  • Loading branch information
fostertheweb committed Jul 10, 2024
1 parent 6334eb2 commit e929ba3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
21 changes: 15 additions & 6 deletions src/SpotifyApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 1 addition & 6 deletions src/auth/ClientCredentialsStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -54,7 +50,6 @@ export default class ClientCredentialsStrategy implements IAuthStrategy {
private async getTokenFromApi(): Promise<AccessToken> {
const options = {
grant_type: "client_credentials",
scope: this.scopes.join(" "),
} as any;

const bodyAsString = Object.keys(options)
Expand Down

0 comments on commit e929ba3

Please sign in to comment.