-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Only extract the needed token information #21
Conversation
According to the documentation the result can contain: * token * expires_at * permissions * repositories Currently it doesn't care about the additional attributes, but it is making the application fail: Traceback (most recent call last): File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "/usr/local/lib/python3.7/site-packages/octomachinery/app/server/machinery.py", line 43, in run_forever async with GitHubApp(config.github) as github_app: File "/usr/local/lib/python3.7/site-packages/octomachinery/github/api/app_client.py", line 69, in __aenter__ self._installations = await self.get_installations() File "/usr/local/lib/python3.7/site-packages/octomachinery/github/api/app_client.py", line 162, in get_installations await installations[install.id].retrieve_access_token() File "/usr/local/lib/python3.7/site-packages/octomachinery/github/entities/app_installation.py", line 49, in retrieve_access_token accept='application/vnd.github.machine-man-preview+json', TypeError: __init__() got an unexpected keyword argument 'permissions' This started to show up when the application was made public and added to another organization. [1]: https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/
Right after deploying this (because the application was failing to start up) I saw a permission error because of an incorrect token so this may still have an issue. It may also be cleaner to store the values of the data we expect. |
Well... The attrs class also kinda acts as a validation layer. I need to think about it. |
self._metadata.access_tokens_url, | ||
data=b'', | ||
accept='application/vnd.github.machine-man-preview+json', | ||
))) | ||
) | ||
self._token = GitHubInstallationAccessToken(token=result['token'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a band-aid... Maybe it needs to be redesigned but for now, I'd definitely want to see the new structure reflected in the model class.
It's a coincidence. I have a public app and it was fine up until yesterday. This API endpoint is marked as |
Note: now sure whether the app should crash if such exception appears. |
Apparently, there's also undocumented |
Confirmed that with version 0.0.17 it works. |
According to the documentation the result can contain:
Currently it doesn't care about the additional attributes, but it is
making the application fail:
This started to show up when the application was made public and added
to another organization.