oauth-backend/lib/utils/is_oauth_uri.py
2025-06-26 12:20:41 +09:00

10 lines
No EOL
331 B
Python

from urllib.parse import urlparse, parse_qs
def is_oauth_uri(uri: str) -> bool:
qs = parse_qs(urlparse(uri).query)
qs_keys = [*qs]
if "client_id" in qs_keys and any(p in qs_keys for p in (
"redirect_uri", "response_type", "grant_type", "scope", "state", "nonce")):
return True
return False