Skip to content

Commit

Permalink
Merge pull request #12 from ephemerallabs/add-state
Browse files Browse the repository at this point in the history
Adding the "state" param to auth code url requests
  • Loading branch information
jmg committed Dec 27, 2012
2 parents d35d504 + 88bca09 commit ee8dbb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion pyfb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,18 @@ def get_auth_token_url(self, redirect_uri):
}
return self._get_auth_url(params, redirect_uri)

def get_auth_code_url(self, redirect_uri):
def get_auth_code_url(self, redirect_uri, state=None):
"""
Returns the url to get a authentication code
"""
params = {
"client_id": self.app_id,
"scope": self._get_permissions(),
}

if state:
params['state'] = state

return self._get_auth_url(params, redirect_uri)

def get_access_token(self, app_secret_key, secret_code, redirect_uri):
Expand Down
4 changes: 2 additions & 2 deletions pyfb/pyfb.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def get_auth_url(self, redirect_uri=None):
"""
return self._client.get_auth_token_url(redirect_uri)

def get_auth_code_url(self, redirect_uri=None):
def get_auth_code_url(self, redirect_uri=None, state=None):
"""
Returns the url to get a authentication code
"""
return self._client.get_auth_code_url(redirect_uri)
return self._client.get_auth_code_url(redirect_uri, state=state)

def get_access_token(self, app_secret_key, secret_code, redirect_uri=None):
"""
Expand Down

0 comments on commit ee8dbb9

Please sign in to comment.