diff --git a/lib/searchpage.dart b/lib/searchpage.dart index 16ec92b5213f96fc4f93b6c8eb6ca7b577accc24..9ec48e87029fef6207f59cd80777b3fb83b3669d 100644 --- a/lib/searchpage.dart +++ b/lib/searchpage.dart @@ -22,6 +22,7 @@ class SearchPage extends State<StateSearcgPage> { @override Widget build(BuildContext context) { + spotifyApi.generateAuthToken(); return Scaffold( body: Padding( padding: const EdgeInsets.all(10.0), diff --git a/lib/services/spotify.dart b/lib/services/spotify.dart index 735c90c7da38c03823ef9f2dfd125193f056910a..1518fd0b62d32bb5920875e3dd725ca374c06580 100644 --- a/lib/services/spotify.dart +++ b/lib/services/spotify.dart @@ -25,10 +25,10 @@ class Spotify { final response = await http.post( Uri.parse('https://accounts.spotify.com/api/token'), body: { - 'grant_type': 'password', - 'username': email, - 'password': password, - 'scope': scope, + "grant_type": "authorization_code", + 'client_id': "$clientId", + "client_secrete": "$clientSecret", + 'scope': "$scope", }, headers: { 'Authorization': encoded, @@ -37,6 +37,7 @@ class Spotify { final responseJson = json.decode(response.body); authToken = responseJson['access_token']; + print(authToken); } catch (e) { // TODO: Handle Error } diff --git a/lib/widgets/navbars.dart b/lib/widgets/navbars.dart index 782c8777c2fc824c5676e0471dab27b349ff2440..f6c3881158742c318e38c1268d0f0f4eb26bef7a 100644 --- a/lib/widgets/navbars.dart +++ b/lib/widgets/navbars.dart @@ -22,12 +22,11 @@ class SettingsDrawer extends StatelessWidget { padding: EdgeInsets.zero, children: [ UserAccountsDrawerHeader( - accountName: user['display_name'], - accountEmail: user['email'], + accountName: Text("Ambient"), + accountEmail: Text("ambient.spotify@gmail.com"), currentAccountPicture: CircleAvatar( child: ClipOval( - child: Image.network( - user['images'][0]['url'], + child: Image.network("https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Angular_full_color_logo.svg/1200px-Angular_full_color_logo.svg.png", width: 90, height: 90, fit: BoxFit.cover,