Skip to content

Commit

Permalink
Prep for v0.1.2, added requests_oauthlib as dependency, added manual …
Browse files Browse the repository at this point in the history
…state parameter for retrieving token
  • Loading branch information
Alexander Schillemans committed Sep 17, 2021
1 parent 4b8a45c commit 3496683
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions exactonline/authhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ def tokenSaver(self, oauth):

return self.token

def retrieveToken(self, response, redirectUri=None):
def retrieveToken(self, response, state=None, redirectUri=None):
if not redirectUri:
if not self.redirectUri: raise NotFoundError('redirect uri is not found. init the auth flow first or give the uri as a parameter.')
redirectUri = self.redirectUri

if not state:
if not self.state: raise NotFoundError('state is not found. init the auth flow first or give the state as a parameter.')
state = self.state

oauth = OAuth2Session(self.clientId, state=self.state, redirect_uri=redirectUri)
oauth = OAuth2Session(self.clientId, state=state, redirect_uri=redirectUri)
self.oauthToken = oauth.fetch_token(self.tokenUrl, client_secret=self.clientSecret, authorization_response=response)

token = self.tokenSaver(oauth)
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
setup(
name = 'python-exact-online',
packages=['exactonline', 'exactonline.models', 'exactonline.constants', 'exactonline.cache', 'exactonline.endpoints'],
version = '0.1.1',
version = '0.1.2',
license='GPL-3.0-or-later',
description = 'Basic wrapper for the Exact Online REST API (v1)',
long_description=long_description,
long_description_content_type='text/markdown',
author = 'Alexander Schillemans',
author_email = '[email protected]',
url = 'https://github.com/alexanderlhsglobal/python-exact-online',
download_url = 'https://github.com/alexanderlhsglobal/python-exact-online/archive/refs/tags/0.1.1.tar.gz',
download_url = 'https://github.com/alexanderlhsglobal/python-exact-online/archive/refs/tags/0.1.2.tar.gz',
keywords = ['exact', 'exact online', 'api'],
install_requires=[
'requests',
'oauthlib',
'requests_oauthlib',
],
classifiers=[
'Development Status :: 3 - Alpha',
Expand Down

0 comments on commit 3496683

Please sign in to comment.