mirror of
https://github.com/c0de-archive/spotipy.git
synced 2024-11-04 23:17:48 +00:00
Merge pull request #147 from mbirtwell/state_per_authorize
Add support for setting state in get_authorise_url
This commit is contained in:
commit
90eceeb530
@ -162,7 +162,7 @@ class SpotifyOAuth(object):
|
||||
now = int(time.time())
|
||||
return token_info['expires_at'] < now
|
||||
|
||||
def get_authorize_url(self):
|
||||
def get_authorize_url(self, state=None):
|
||||
""" Gets the URL to use to authorize this app
|
||||
"""
|
||||
payload = {'client_id': self.client_id,
|
||||
@ -170,8 +170,10 @@ class SpotifyOAuth(object):
|
||||
'redirect_uri': self.redirect_uri}
|
||||
if self.scope:
|
||||
payload['scope'] = self.scope
|
||||
if self.state:
|
||||
payload['state'] = self.state
|
||||
if state is None:
|
||||
state = self.state
|
||||
if state is not None:
|
||||
payload['state'] = state
|
||||
|
||||
urlparams = urllibparse.urlencode(payload)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user