prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Not sure that OAuth2 client source should use authorization header
  I've been testing authentik using an Auth0 openIDC source as well as a google source. I have gotten both to work, but Auth0 was not working before a fix to prevent adding the access token to the authorizaton Bearer headers. Google auth works fine with or without this fix. 
  
  https://auth0.com/blog/id-token-access-token-what-is-the-difference/ suggests that many endpoints should not be given the access token. Not sure this is relevant.
  
  I think Auth0 is less permissive and prefers the access_token param rather than the Authorization Bearer token
  
  in sources/oauth/clients/oauth2.py
  ```
  class OAuth2Client(BaseOAuthClient):
      """OAuth2 Client"""
  
     ...
  
      def do_request(self, method: str, url: str, **kwargs) -> Response:
          """Build remote url request. Constructs necessary auth."""
          if "token" in kwargs:
              token = kwargs.pop("token")
  
              params = kwargs.get("params", {})
              params["access_token"] = token["access_token"]
              kwargs["params"] = params
  
              headers = kwargs.get("headers", {})
              # Note this fix
              # headers["Authorization"] = f"{token['token_type']} {token['access_token']}"
              kwargs["headers"] = headers
          return super().do_request(method, url, **kwargs)
  ```
  
  
  
  </issue>
  <code>
  [start of authentik/sources/oauth/types/oidc.py]
  1 """OpenID Connect OAuth Views"""
  2 from typing import Any
  3 
  4 from authentik.sources.oauth.clients.oauth2 import UserprofileHeaderAuthClient
  5 from authentik.sources.oauth.models import OAuthSource
  6 from authentik.sources.oauth.types.registry import SourceType, registry
  7 from authentik.sources.oauth.views.callback import OAuthCallback
  8 from authentik.sources.oauth.views.redirect import OAuthRedirect
  9 
  10 
  11 class OpenIDConnectOAuthRedirect(OAuthRedirect):
  12     """OpenIDConnect OAuth2 Redirect"""
  13 
  14     def get_additional_parameters(self, source: OAuthSource):  # pragma: no cover
  15         return {
  16             "scope": ["openid", "email", "profile"],
  17         }
  18 
  19 
  20 class OpenIDConnectOAuth2Callback(OAuthCallback):
  21     """OpenIDConnect OAuth2 Callback"""
  22 
  23     client_class: UserprofileHeaderAuthClient
  24 
  25     def get_user_id(self, info: dict[str, str]) -> str:
  26         return info.get("sub", "")
  27 
  28     def get_user_enroll_context(
  29         self,
  30         info: dict[str, Any],
  31     ) -> dict[str, Any]:
  32         return {
  33             "username": info.get("nickname", info.get("preferred_username")),
  34             "email": info.get("email"),
  35             "name": info.get("name"),
  36         }
  37 
  38 
  39 @registry.register()
  40 class OpenIDConnectType(SourceType):
  41     """OpenIDConnect Type definition"""
  42 
  43     callback_view = OpenIDConnectOAuth2Callback
  44     redirect_view = OpenIDConnectOAuthRedirect
  45     name = "OpenID Connect"
  46     slug = "openidconnect"
  47 
  48     urls_customizable = True
  49
  [end of authentik/sources/oauth/types/oidc.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/authentik/sources/oauth/types/oidc.py b/authentik/sources/oauth/types/oidc.py
  --- a/authentik/sources/oauth/types/oidc.py
  +++ b/authentik/sources/oauth/types/oidc.py
  @@ -20,7 +20,7 @@
   class OpenIDConnectOAuth2Callback(OAuthCallback):
       """OpenIDConnect OAuth2 Callback"""
   
  -    client_class: UserprofileHeaderAuthClient
  +    client_class = UserprofileHeaderAuthClient
   
       def get_user_id(self, info: dict[str, str]) -> str:
           return info.get("sub", "")
  
verification_info: {"golden_diff": "diff --git a/authentik/sources/oauth/types/oidc.py b/authentik/sources/oauth/types/oidc.py\n--- a/authentik/sources/oauth/types/oidc.py\n+++ b/authentik/sources/oauth/types/oidc.py\n@@ -20,7 +20,7 @@\n class OpenIDConnectOAuth2Callback(OAuthCallback):\n     \"\"\"OpenIDConnect OAuth2 Callback\"\"\"\n \n-    client_class: UserprofileHeaderAuthClient\n+    client_class = UserprofileHeaderAuthClient\n \n     def get_user_id(self, info: dict[str, str]) -> str:\n         return info.get(\"sub\", \"\")\n", "issue": "Not sure that OAuth2 client source should use authorization header\nI've been testing authentik using an Auth0 openIDC source as well as a google source. I have gotten both to work, but Auth0 was not working before a fix to prevent adding the access token to the authorizaton Bearer headers. Google auth works fine with or without this fix. \r\n\r\nhttps://auth0.com/blog/id-token-access-token-what-is-the-difference/ suggests that many endpoints should not be given the access token. Not sure this is relevant.\r\n\r\nI think Auth0 is less permissive and prefers the access_token param rather than the Authorization Bearer token\r\n\r\nin sources/oauth/clients/oauth2.py\r\n```\r\nclass OAuth2Client(BaseOAuthClient):\r\n    \"\"\"OAuth2 Client\"\"\"\r\n\r\n   ...\r\n\r\n    def do_request(self, method: str, url: str, **kwargs) -> Response:\r\n        \"\"\"Build remote url request. Constructs necessary auth.\"\"\"\r\n        if \"token\" in kwargs:\r\n            token = kwargs.pop(\"token\")\r\n\r\n            params = kwargs.get(\"params\", {})\r\n            params[\"access_token\"] = token[\"access_token\"]\r\n            kwargs[\"params\"] = params\r\n\r\n            headers = kwargs.get(\"headers\", {})\r\n            # Note this fix\r\n            # headers[\"Authorization\"] = f\"{token['token_type']} {token['access_token']}\"\r\n            kwargs[\"headers\"] = headers\r\n        return super().do_request(method, url, **kwargs)\r\n```\r\n\r\n\n", "before_files": [{"content": "\"\"\"OpenID Connect OAuth Views\"\"\"\nfrom typing import Any\n\nfrom authentik.sources.oauth.clients.oauth2 import UserprofileHeaderAuthClient\nfrom authentik.sources.oauth.models import OAuthSource\nfrom authentik.sources.oauth.types.registry import SourceType, registry\nfrom authentik.sources.oauth.views.callback import OAuthCallback\nfrom authentik.sources.oauth.views.redirect import OAuthRedirect\n\n\nclass OpenIDConnectOAuthRedirect(OAuthRedirect):\n    \"\"\"OpenIDConnect OAuth2 Redirect\"\"\"\n\n    def get_additional_parameters(self, source: OAuthSource):  # pragma: no cover\n        return {\n            \"scope\": [\"openid\", \"email\", \"profile\"],\n        }\n\n\nclass OpenIDConnectOAuth2Callback(OAuthCallback):\n    \"\"\"OpenIDConnect OAuth2 Callback\"\"\"\n\n    client_class: UserprofileHeaderAuthClient\n\n    def get_user_id(self, info: dict[str, str]) -> str:\n        return info.get(\"sub\", \"\")\n\n    def get_user_enroll_context(\n        self,\n        info: dict[str, Any],\n    ) -> dict[str, Any]:\n        return {\n            \"username\": info.get(\"nickname\", info.get(\"preferred_username\")),\n            \"email\": info.get(\"email\"),\n            \"name\": info.get(\"name\"),\n        }\n\n\n@registry.register()\nclass OpenIDConnectType(SourceType):\n    \"\"\"OpenIDConnect Type definition\"\"\"\n\n    callback_view = OpenIDConnectOAuth2Callback\n    redirect_view = OpenIDConnectOAuthRedirect\n    name = \"OpenID Connect\"\n    slug = \"openidconnect\"\n\n    urls_customizable = True\n", "path": "authentik/sources/oauth/types/oidc.py"}]}