Auth

Authorization refers to the process of granting a user or application access permissions to Spotify data and features. Spotify implements the OAuth 2.0 authorization

The access to the protected resources is determined by one or several scopes. Scopes enable your application to access specific functionality (e.g. read a playlist, modify your library or just streaming) on behalf of a user. The set of scopes you set during the authorization, determines the access permissions that the user is asked to grant. You can find detailed information about scopes in the scopes guide

For the calls we’re using, we need the “user-top-read” scope.

Documentation: https://developer.spotify.com/documentation/general/guides/authorization/

Get User's Top Items

Get the current user's top artists or tracks based on calculated affinity.

Parameters

type: The type of entity to return.

tracks

artists

limit: The maximum number of items to return.

1-50 tracks

Default: 20 tracks

time_range: Over what time frame the affinities are computed.

short_term - approximately last 4 weeks

medium_term (default): approximately last 6 months

long_term: several years

Response

Several fields about the user favorite tracks, the most important for us is “id”, because with that we can call the Get Tracks' Audio Features API