Spotify Auth
Cordova plugin for authenticating with Spotify
https://github.com/Festify/cordova-spotify-oauth
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation#
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-spotify-oauth $ npm install @ionic-native/spotify-auth $ ionic cap sync
$ ionic cordova plugin add cordova-spotify-oauth $ npm install @ionic-native/spotify-auth
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
#
Supported Platforms- Android
- iOS
#
Usage#
ReactLearn more about using Ionic Native components in React
#
Angularimport { SpotifyAuth } from '@ionic-native/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"], // see Spotify Dev console for all scopes 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();
// [...]