From dfda14b3f2f8a591a70fb39f2ecc524180ad94e2 Mon Sep 17 00:00:00 2001 From: Marton Date: Mon, 1 Jun 2020 17:57:04 +0200 Subject: [PATCH] fix: spotify auth issue --- src/components/spotify/script.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/spotify/script.ts b/src/components/spotify/script.ts index 3b552b4..36d342f 100644 --- a/src/components/spotify/script.ts +++ b/src/components/spotify/script.ts @@ -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() { @@ -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; }); } } @@ -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(); } @@ -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())