javascript - Spotify OAuth without login form angular js -
i'm building simple web app recording studio. fetches tracks one, specific spotify playlist using angular-spotify library. https://github.com/eddiemoore/angular-spotify
i grab data , plug little cover-art-grid audio player.
everything running smoothly -- until oauth token expires :/
how can implement authorization flow allow app snag refresh token without login form in angular library? need own app access own playlist. (spotify touches on briefly in documentation, not in great detail)
here's code i'm using right make request expires after while.
// private information in config function has been swapped out placeholders between "<>". var app = angular.module('myapp', ['spotify']); // app.config(function (spotifyprovider) { spotifyprovider.setclientid('<client id>'); spotifyprovider.setredirecturi('<redirect-uri> '); spotifyprovider.setscope('playlist-read-private'); // // if have auth token spotifyprovider.setauthtoken('<oauth token>'); }); app.controller('mainctrl',['$scope', 'spotify', function($scope, spotify){ spotify.getplaylisttracks('oneofonedesignco', '5994q1h87nbxa1r2xsow0s').then(function (data) { $scope.tracks = data.items; console.log($scope.tracks); });
Comments
Post a Comment