Skip to content

Commit

Permalink
Add accept header in GitHub code exchange (#6206)
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttrinh committed Oct 3, 2023
1 parent 7dde356 commit 2425582
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion edb/server/protocol/auth_ext/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import urllib.parse
import functools

from . import base, data
from . import base, data, errors


class GitHubProvider(base.BaseProvider):
Expand Down Expand Up @@ -58,7 +58,14 @@ async def exchange_code(
"client_secret": self.client_secret,
"redirect_uri": redirect_uri,
},
headers={
"accept": "application/json",
}
)
if resp.status_code >= 400:
raise errors.OAuthProviderFailure(
f"Failed to exchange code: {resp.text}"
)
json = resp.json()

return data.OAuthAccessTokenResponse(**json)
Expand Down

0 comments on commit 2425582

Please sign in to comment.