Skip to content
Snippets Groups Projects
Commit 8b543895 authored by Daniel Furaev's avatar Daniel Furaev
Browse files

generate auth token hoffentlich

parent 53dd42db
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ class SearchPage extends State<StateSearcgPage> { ...@@ -22,6 +22,7 @@ class SearchPage extends State<StateSearcgPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
spotifyApi.generateAuthToken();
return Scaffold( return Scaffold(
body: Padding( body: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
......
...@@ -25,10 +25,10 @@ class Spotify { ...@@ -25,10 +25,10 @@ class Spotify {
final response = await http.post( final response = await http.post(
Uri.parse('https://accounts.spotify.com/api/token'), Uri.parse('https://accounts.spotify.com/api/token'),
body: { body: {
'grant_type': 'password', "grant_type": "authorization_code",
'username': email, 'client_id': "$clientId",
'password': password, "client_secrete": "$clientSecret",
'scope': scope, 'scope': "$scope",
}, },
headers: { headers: {
'Authorization': encoded, 'Authorization': encoded,
...@@ -37,6 +37,7 @@ class Spotify { ...@@ -37,6 +37,7 @@ class Spotify {
final responseJson = json.decode(response.body); final responseJson = json.decode(response.body);
authToken = responseJson['access_token']; authToken = responseJson['access_token'];
print(authToken);
} catch (e) { } catch (e) {
// TODO: Handle Error // TODO: Handle Error
} }
......
...@@ -22,12 +22,11 @@ class SettingsDrawer extends StatelessWidget { ...@@ -22,12 +22,11 @@ class SettingsDrawer extends StatelessWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
children: [ children: [
UserAccountsDrawerHeader( UserAccountsDrawerHeader(
accountName: user['display_name'], accountName: Text("Ambient"),
accountEmail: user['email'], accountEmail: Text("ambient.spotify@gmail.com"),
currentAccountPicture: CircleAvatar( currentAccountPicture: CircleAvatar(
child: ClipOval( child: ClipOval(
child: Image.network( child: Image.network("https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Angular_full_color_logo.svg/1200px-Angular_full_color_logo.svg.png",
user['images'][0]['url'],
width: 90, width: 90,
height: 90, height: 90,
fit: BoxFit.cover, fit: BoxFit.cover,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment