Skip to content

Commit

Permalink
Add force_verify to adapters.
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Mar 18, 2024
1 parent 7f7716a commit 7dd3246
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 1 addition & 2 deletions twitchio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from twitchio.http import HTTPAsyncIterator

from .authentication import ManagedHTTPClient, Scopes
from .payloads import EventErrorPayload
from .models import (
ChannelInfo,
ChatterColor,
Expand All @@ -45,7 +44,7 @@
Stream,
Team,
)

from .payloads import EventErrorPayload
from .web import AiohttpAdapter, WebAdapter


Expand Down
6 changes: 6 additions & 0 deletions twitchio/web/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ async def oauth_callback(self, request: Request) -> Response:

async def oauth_redirect(self, request: Request) -> Response:
scopes: str | None = request.query_params.get("scopes", None)
force_verify: bool = request.query_params.get("force_verify", "false").lower() == "true"

if not scopes:
scopes = str(self.client._http.scopes) if self.client._http.scopes else None

Expand All @@ -143,6 +145,7 @@ async def oauth_redirect(self, request: Request) -> Response:
payload: AuthorizationURLPayload = self.client._http.get_authorization_url(
scopes=scopes_,
redirect_uri=self._redirect_uri,
force_verify=force_verify,
)
except Exception as e:
logger.error(
Expand Down Expand Up @@ -231,6 +234,8 @@ async def oauth_callback(self, request: web.Request) -> web.Response:

async def oauth_redirect(self, request: web.Request) -> web.Response:
scopes: str | None = request.query.get("scopes", None)
force_verify: bool = request.query.get("force_verify", "false").lower() == "true"

if not scopes:
scopes = str(self.client._http.scopes) if self.client._http.scopes else None

Expand All @@ -247,6 +252,7 @@ async def oauth_redirect(self, request: web.Request) -> web.Response:
payload: AuthorizationURLPayload = self.client._http.get_authorization_url(
scopes=scopes_,
redirect_uri=self._redirect_uri,
force_verify=force_verify,
)
except Exception as e:
logger.error(
Expand Down

0 comments on commit 7dd3246

Please sign in to comment.