Skip to content

Commit

Permalink
removed scope parameter from the constructor of ClientCredentialsStat…
Browse files Browse the repository at this point in the history
…egy, its finale request and withClientCredentials method
  • Loading branch information
KirtanSoni committed Dec 22, 2023
1 parent 5d14751 commit 3197d15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/SpotifyApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ export class SpotifyApi {
return new SpotifyApi(strategy, config);
}

public static withClientCredentials(clientId: string, clientSecret: string, scopes: string[] = [], config?: SdkOptions): SpotifyApi {
const strategy = new ClientCredentialsStrategy(clientId, clientSecret, scopes);
public static withClientCredentials(clientId: string, clientSecret: string, config?: SdkOptions): SpotifyApi {//change
const strategy = new ClientCredentialsStrategy(clientId, clientSecret);
return new SpotifyApi(strategy, config);
}

Expand Down
6 changes: 2 additions & 4 deletions src/auth/ClientCredentialsStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export default class ClientCredentialsStrategy implements IAuthStrategy {

constructor(
private clientId: string,
private clientSecret: string,
private scopes: string[] = []
private clientSecret: string
) {
}

Expand Down Expand Up @@ -46,8 +45,7 @@ export default class ClientCredentialsStrategy implements IAuthStrategy {

private async getTokenFromApi(): Promise<AccessToken> {
const options = {
grant_type: 'client_credentials',
scope: this.scopes.join(' ')
grant_type: 'client_credentials'
} as any;

const bodyAsString = Object.keys(options).map(key => key + '=' + options[key]).join('&');
Expand Down

0 comments on commit 3197d15

Please sign in to comment.