def request_authorization(self):
"""Returns an URL the user has to follow to authorize this app."""
# Requests authorization
request_secret = secrets.token_hex()
payload = {
'client_id': self.__client_id,
'response_type': 'code',
'redirect_uri': 'https://localhost:4000/steps/2',
'scope': 'user-read-recently-played',
'state': request_secret
}
params = ("{}={}".format(param, value)
for param, value
in payload.items())
auth_url = 'https://accounts.spotify.com/authorize?{}'.format(
'&'.join(params))
return auth_url
评论列表
文章目录