prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Use of access tokens as query parameters in the GitHub OAuth API is deprecated
  **Summary**
  We use GitHub's OAuth API as one of MDN's sign-up/sign-in OAuth providers. We're starting to receive emails from GitHub that using the https://api.github.com/user API with the access token as a query parameter has been deprecated and that the `Authorization` header should be used instead. This occurs within `GitHubOAuth2Adapter.complete_login` method provided by `django-allauth`, but `django-allauth` has not yet fixed this (although a PR has been submitted that does -- see https://github.com/pennersr/django-allauth/pull/2458). Even if `django-allauth` fixes the issue, it wouldn't help in our case since we override this method (https://github.com/mdn/kuma/blob/266bd9d8ebf24c950037a1965b1967022fca233f/kuma/users/providers/github/views.py#L20). We need to update our overridden method to pass the token via the `Authorization` header rather than via a query parameter.
  
  **Rationale**
  We no longer have to concern ourselves with using a deprecated approach.
  
  **Audience**
  All users who sign-up/sign-in to MDN via GitHub.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kuma/users/providers/github/views.py`
  Content:
  ```
  1 from allauth.account.utils import get_next_redirect_url
  2 from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter
  3 from allauth.socialaccount.providers.oauth2.views import (OAuth2CallbackView,
  4                                                           OAuth2LoginView)
  5 
  6 from kuma.core.decorators import redirect_in_maintenance_mode
  7 from kuma.core.urlresolvers import reverse
  8 from kuma.core.utils import requests_retry_session
  9 
  10 
  11 class KumaGitHubOAuth2Adapter(GitHubOAuth2Adapter):
  12     """
  13     A custom GitHub OAuth adapter to be used for fetching the list
  14     of private email addresses stored for the given user at GitHub.
  15 
  16     We store those email addresses in the extra data of each account.
  17     """
  18     email_url = 'https://api.github.com/user/emails'
  19 
  20     def complete_login(self, request, app, token, **kwargs):
  21         session = requests_retry_session()
  22         params = {'access_token': token.token}
  23         profile_data = session.get(self.profile_url, params=params)
  24         profile_data.raise_for_status()
  25         extra_data = profile_data.json()
  26         email_data = session.get(self.email_url, params=params)
  27         email_data.raise_for_status()
  28         extra_data['email_addresses'] = email_data.json()
  29         return self.get_provider().sociallogin_from_response(request,
  30                                                              extra_data)
  31 
  32 
  33 class KumaOAuth2LoginView(OAuth2LoginView):
  34 
  35     def dispatch(self, request):
  36         next_url = (get_next_redirect_url(request) or
  37                     reverse('users.my_edit_page'))
  38         request.session['sociallogin_next_url'] = next_url
  39         request.session.modified = True
  40         return super(KumaOAuth2LoginView, self).dispatch(request)
  41 
  42 
  43 oauth2_login = redirect_in_maintenance_mode(
  44     KumaOAuth2LoginView.adapter_view(KumaGitHubOAuth2Adapter)
  45 )
  46 oauth2_callback = redirect_in_maintenance_mode(
  47     OAuth2CallbackView.adapter_view(KumaGitHubOAuth2Adapter)
  48 )
  49
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/kuma/users/providers/github/views.py b/kuma/users/providers/github/views.py
  --- a/kuma/users/providers/github/views.py
  +++ b/kuma/users/providers/github/views.py
  @@ -19,11 +19,11 @@
   
       def complete_login(self, request, app, token, **kwargs):
           session = requests_retry_session()
  -        params = {'access_token': token.token}
  -        profile_data = session.get(self.profile_url, params=params)
  +        headers = {'Authorization': f'token {token.token}'}
  +        profile_data = session.get(self.profile_url, headers=headers)
           profile_data.raise_for_status()
           extra_data = profile_data.json()
  -        email_data = session.get(self.email_url, params=params)
  +        email_data = session.get(self.email_url, headers=headers)
           email_data.raise_for_status()
           extra_data['email_addresses'] = email_data.json()
           return self.get_provider().sociallogin_from_response(request,
  
verification_info: {"golden_diff": "diff --git a/kuma/users/providers/github/views.py b/kuma/users/providers/github/views.py\n--- a/kuma/users/providers/github/views.py\n+++ b/kuma/users/providers/github/views.py\n@@ -19,11 +19,11 @@\n \n     def complete_login(self, request, app, token, **kwargs):\n         session = requests_retry_session()\n-        params = {'access_token': token.token}\n-        profile_data = session.get(self.profile_url, params=params)\n+        headers = {'Authorization': f'token {token.token}'}\n+        profile_data = session.get(self.profile_url, headers=headers)\n         profile_data.raise_for_status()\n         extra_data = profile_data.json()\n-        email_data = session.get(self.email_url, params=params)\n+        email_data = session.get(self.email_url, headers=headers)\n         email_data.raise_for_status()\n         extra_data['email_addresses'] = email_data.json()\n         return self.get_provider().sociallogin_from_response(request,\n", "issue": "Use of access tokens as query parameters in the GitHub OAuth API is deprecated\n**Summary**\r\nWe use GitHub's OAuth API as one of MDN's sign-up/sign-in OAuth providers. We're starting to receive emails from GitHub that using the https://api.github.com/user API with the access token as a query parameter has been deprecated and that the `Authorization` header should be used instead. This occurs within `GitHubOAuth2Adapter.complete_login` method provided by `django-allauth`, but `django-allauth` has not yet fixed this (although a PR has been submitted that does -- see https://github.com/pennersr/django-allauth/pull/2458). Even if `django-allauth` fixes the issue, it wouldn't help in our case since we override this method (https://github.com/mdn/kuma/blob/266bd9d8ebf24c950037a1965b1967022fca233f/kuma/users/providers/github/views.py#L20). We need to update our overridden method to pass the token via the `Authorization` header rather than via a query parameter.\r\n\r\n**Rationale**\r\nWe no longer have to concern ourselves with using a deprecated approach.\r\n\r\n**Audience**\r\nAll users who sign-up/sign-in to MDN via GitHub.\r\n\n", "before_files": [{"content": "from allauth.account.utils import get_next_redirect_url\nfrom allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter\nfrom allauth.socialaccount.providers.oauth2.views import (OAuth2CallbackView,\n                                                          OAuth2LoginView)\n\nfrom kuma.core.decorators import redirect_in_maintenance_mode\nfrom kuma.core.urlresolvers import reverse\nfrom kuma.core.utils import requests_retry_session\n\n\nclass KumaGitHubOAuth2Adapter(GitHubOAuth2Adapter):\n    \"\"\"\n    A custom GitHub OAuth adapter to be used for fetching the list\n    of private email addresses stored for the given user at GitHub.\n\n    We store those email addresses in the extra data of each account.\n    \"\"\"\n    email_url = 'https://api.github.com/user/emails'\n\n    def complete_login(self, request, app, token, **kwargs):\n        session = requests_retry_session()\n        params = {'access_token': token.token}\n        profile_data = session.get(self.profile_url, params=params)\n        profile_data.raise_for_status()\n        extra_data = profile_data.json()\n        email_data = session.get(self.email_url, params=params)\n        email_data.raise_for_status()\n        extra_data['email_addresses'] = email_data.json()\n        return self.get_provider().sociallogin_from_response(request,\n                                                             extra_data)\n\n\nclass KumaOAuth2LoginView(OAuth2LoginView):\n\n    def dispatch(self, request):\n        next_url = (get_next_redirect_url(request) or\n                    reverse('users.my_edit_page'))\n        request.session['sociallogin_next_url'] = next_url\n        request.session.modified = True\n        return super(KumaOAuth2LoginView, self).dispatch(request)\n\n\noauth2_login = redirect_in_maintenance_mode(\n    KumaOAuth2LoginView.adapter_view(KumaGitHubOAuth2Adapter)\n)\noauth2_callback = redirect_in_maintenance_mode(\n    OAuth2CallbackView.adapter_view(KumaGitHubOAuth2Adapter)\n)\n", "path": "kuma/users/providers/github/views.py"}], "after_files": [{"content": "from allauth.account.utils import get_next_redirect_url\nfrom allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter\nfrom allauth.socialaccount.providers.oauth2.views import (OAuth2CallbackView,\n                                                          OAuth2LoginView)\n\nfrom kuma.core.decorators import redirect_in_maintenance_mode\nfrom kuma.core.urlresolvers import reverse\nfrom kuma.core.utils import requests_retry_session\n\n\nclass KumaGitHubOAuth2Adapter(GitHubOAuth2Adapter):\n    \"\"\"\n    A custom GitHub OAuth adapter to be used for fetching the list\n    of private email addresses stored for the given user at GitHub.\n\n    We store those email addresses in the extra data of each account.\n    \"\"\"\n    email_url = 'https://api.github.com/user/emails'\n\n    def complete_login(self, request, app, token, **kwargs):\n        session = requests_retry_session()\n        headers = {'Authorization': f'token {token.token}'}\n        profile_data = session.get(self.profile_url, headers=headers)\n        profile_data.raise_for_status()\n        extra_data = profile_data.json()\n        email_data = session.get(self.email_url, headers=headers)\n        email_data.raise_for_status()\n        extra_data['email_addresses'] = email_data.json()\n        return self.get_provider().sociallogin_from_response(request,\n                                                             extra_data)\n\n\nclass KumaOAuth2LoginView(OAuth2LoginView):\n\n    def dispatch(self, request):\n        next_url = (get_next_redirect_url(request) or\n                    reverse('users.my_edit_page'))\n        request.session['sociallogin_next_url'] = next_url\n        request.session.modified = True\n        return super(KumaOAuth2LoginView, self).dispatch(request)\n\n\noauth2_login = redirect_in_maintenance_mode(\n    KumaOAuth2LoginView.adapter_view(KumaGitHubOAuth2Adapter)\n)\noauth2_callback = redirect_in_maintenance_mode(\n    OAuth2CallbackView.adapter_view(KumaGitHubOAuth2Adapter)\n)\n", "path": "kuma/users/providers/github/views.py"}]}