Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update oauth2.py to include provider Xero #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jenksguo
Copy link

@jenksguo jenksguo commented Feb 1, 2020

The added class Xero(OAuth2) will support the recently released Xero OAuth 2.0 APIs.

The flow respects Xero OAuth 2.0 flow and provide user information by decoding the JWT token returned via OpenID connect.

Example for refresh token:
result.user.credentials.refresh()

Example for accessing protected resources:
authomatic.access(
result.user.credentials,
headers={
"xero-tenant-id": first_tenantId,
}, url='https://api.xero.com/api.xro/2.0/Contacts')

The added class Xero(OAuth2) will support the recently released Xero OAuth 2.0 APIs.

The flow respects Xero OAuth 2.0 flow and provide user information by decoding the JWT token returned via OpenID connect.

Example for refresh token:
result.user.credentials.refresh()

Example for accessing protected resources:
authomatic.access(
                result.user.credentials,
                headers={
                    "xero-tenant-id": first_tenantId,
                }, url='https://api.xero.com/api.xro/2.0/Contacts')
@jenksguo
Copy link
Author

jenksguo commented Feb 1, 2020

Xero only provides user info in jwt token, so for this to work, the oauth2.py need to have python-jwt dependency included.

build error:
ERROR: InvocationError for command /home/travis/build/authomatic/authomatic/.tox/py3/bin/pylint --errors-only --ignore=six.py authomatic (exited with code 2)

@mrichar1
Copy link
Member

mrichar1 commented Feb 9, 2020

Thanks for this PR. To start with can you add the jwt dependency to the deps list in tox.ini - this should get the most basic of tests running properly against this change.

It looks like in the past e haven't had the test suite run against Xero as it's a paid for service, which would require a 'free trial' account to be generated every month, which is too much effort. Please let us know if this is still the case? If so we would review and accept the pull request without testing and just add a caveat to the documentation explaining this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Issue-Management
  
New: Needs Check
Development

Successfully merging this pull request may close these issues.

None yet

2 participants