Skip to content

Commit

Permalink
make token_url "" on default
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Jun 27, 2024
1 parent 91d3e79 commit 3aa1b2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions rest_tools/client/device_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""device_client.py"""

# fmt:off

import io
import logging
import time
Expand All @@ -12,8 +16,6 @@
from ..utils.auth import OpenIDAuth


# fmt:off

def _print_qrcode(req: Dict[str, str]) -> None:
if 'verification_uri_complete' not in req:
req['verification_uri_complete'] = req['verification_uri']+'?user_code='+req['user_code']
Expand Down Expand Up @@ -149,7 +151,7 @@ def DeviceGrantAuth(
auth = OpenIDAuth(token_url)
if 'device_authorization_endpoint' not in auth.provider_info:
raise RuntimeError('Device grant not supported by server')
endpoint = auth.provider_info['device_authorization_endpoint']
endpoint: str = auth.provider_info['device_authorization_endpoint'] # type: ignore

refresh_token = _perform_device_grant(
logger, endpoint, auth.token_url, client_id, client_secret, scopes
Expand Down Expand Up @@ -227,7 +229,7 @@ def update_func(access, refresh):
raise RuntimeError('Token service does not support .well-known discovery')
if 'device_authorization_endpoint' not in auth.provider_info:
raise RuntimeError('Device grant not supported by server')
endpoint = auth.provider_info['device_authorization_endpoint']
endpoint: str = auth.provider_info['device_authorization_endpoint'] # type: ignore

refresh_token = _perform_device_grant(
logger, endpoint, auth.token_url, client_id, client_secret, scopes
Expand Down
2 changes: 1 addition & 1 deletion rest_tools/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(
self.url = url if url.endswith("/") else url + "/"
self.public_keys: Dict[str, RSAPublicKey] = {}
self.provider_info = provider_info if provider_info else {}
self.token_url: Optional[str] = None
self.token_url = ""

self._refresh_keys()

Expand Down

0 comments on commit 3aa1b2c

Please sign in to comment.