import { SpotifyAuth } from '@awesome-cordova-plugins/spotify-auth/ngx';
constructor(private spotifyAuth: SpotifyAuth) { }
const config = {
clientId: "<SPOTIFY CLIENT ID>",
redirectUrl: "<REDIRECT URL, MUST MATCH WITH AUTH ENDPOINT AND SPOTIFY DEV CONSOLE>",
scopes: ["streaming"],
tokenExchangeUrl: "<URL OF TOKEN EXCHANGE HTTP ENDPOINT>",
tokenRefreshUrl: "<URL OF TOKEN REFRESH HTTP ENDPOINT>",
};
...
this.spotifyAuth.authorize(config)
.then(({ accessToken, expiresAt }) => {
console.log(`Got an access token, its ${accessToken}!`);
console.log(`Its going to expire in ${expiresAt - Date.now()}ms.`);
});
this.spotifyAuth.forget();