Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
fix: spotify auth issue
Browse files Browse the repository at this point in the history
  • Loading branch information
martonborzak committed Jun 1, 2020
1 parent 8eaff62 commit dfda14b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/spotify/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class Spotify extends Vue {
public clientId: string = '';
public clientSecret: string = '';
public accessToken: string = '';
public refreshToken: string = '';
public redirectUrl: string = `${window.location.origin}`;

public get isInAuthenticationCycle() {
Expand All @@ -46,7 +47,7 @@ export default class Spotify extends Vue {
this.clientSecret = options.clientSecret;

this.spotifyAuthentication.requestTokens(this.clientId, this.clientSecret, this.redirectUrl)
.then(() => this.accessToken = this.spotifyAuthentication.accessToken);
.then(() => { this.accessToken = this.spotifyAuthentication.accessToken; this.refreshToken = this.spotifyAuthentication.refreshToken; });
}
}

Expand Down Expand Up @@ -79,6 +80,7 @@ export default class Spotify extends Vue {
this.clientId = '';
this.clientSecret = '';
this.accessToken = '';
this.refreshToken = '';
window.sessionStorage.removeItem('yio.spotify');
this.spotifyAuthentication.reset();
}
Expand All @@ -93,7 +95,8 @@ export default class Spotify extends Vue {
entity_id: `spotify_${`${Guid.create()}`.substr(0, 4)}`,
client_id: this.clientId,
client_secret: this.clientSecret,
access_token: this.accessToken
access_token: this.accessToken,
refresh_token: this.refreshToken
}
})
.then(() => this.onCancel())
Expand Down

0 comments on commit dfda14b

Please sign in to comment.