-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(GithubEnterpriseIntegration): Adding Authorization-header for installations-request #26281
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
Conversation
…tallations-request GitHub Enterprise has deprecated using `access_token` only in querystring. Response from newer versions: ```json { "message": "Must specify access token via Authorization header", "documentation_url": "https://docs.github.com/enterprise/3.0/v3/#oauth2-token-sent-in-a-header" } ```
/gcbrun |
Thanks a lot @itssimple! I think this was overlooked when fixing the main GitHub auth a while ago. Pinging the @getsentry/ecosystem team for a review and merge. |
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.
@itssimple Thank you putting up this PR !
Just a couple of things:
I would recommend adding match_querystring=True
to the responses made to the /user
endpoints in the GHE tests to just verify that we are making requests without the access token in the query param. (even though we are mocking out the response)
Here is one of the requests, the other is some lines above:
sentry/tests/sentry/integrations/github_enterprise/test_integration.py
Lines 97 to 101 in 1bd0ad9
responses.add( | |
responses.GET, | |
self.base_url + "/user/installations", | |
json={"installations": [{"id": installation_id}]}, | |
) |
Additionally, can you tell me which version of GHE you tested this out on?
|
||
resp = session.get( | ||
"https://{}/api/v3/user/installations".format(installation_data["url"]), | ||
params={"access_token": access_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.
Let's remove the params
here since you are adding the access_token
to the headers now
@MeredithAnya Thanks for checking the PR! I have committed the changes requested by adding the I'm testing this against a 3.0.7 version of GHE. |
/gcbrun |
Thanks for removing the params ! The responses.add(
responses.GET,
self.base_url + "/user/installations",
json={"installations": [{"id": installation_id}]},
match_querystring=True,
) after that I think things should be good |
Ah, sorry. It's my first time modifying Python. :) |
/gcbrun |
/gcbrun |
/gcbrun |
/gcbrun |
we got this team !
|
GitHub Enterprise has deprecated using
access_token
only in querystring.Response from newer versions: