Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- findUserId() {
- if(accessToken === undefined) {
- this.getAccessToken();
- }
- console.log(accessToken);
- let userId;
- return fetch(`https://api.spotify.com/v1/me`, {'Authorization': `Bearer ${accessToken}`}}
- ).then(response => {return response.json()}
- ).then(jsonResponse => {
- return jsonResponse.id;
- });
- }
- // use as
- findUserId().then(id => {
- console.log(id)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement