diff --git a/nylas/models/auth.py b/nylas/models/auth.py index 29ef0a1a..dca5dba5 100644 --- a/nylas/models/auth.py +++ b/nylas/models/auth.py @@ -107,6 +107,7 @@ class CodeExchangeResponse: access_token: str grant_id: str + email: str scope: str expires_in: int refresh_token: Optional[str] = None diff --git a/nylas/resources/auth.py b/nylas/resources/auth.py index 37d5c013..2c6a90a9 100644 --- a/nylas/resources/auth.py +++ b/nylas/resources/auth.py @@ -27,10 +27,10 @@ def _hash_pkce_secret(secret: str) -> str: def _build_query(config: dict) -> dict: config["response_type"] = "code" - if not config["access_type"]: + if "access_type" not in config: config["access_type"] = "online" - if config["scope"]: + if "scope" in config: config["scope"] = " ".join(config["scope"]) return config @@ -49,7 +49,9 @@ def _build_query_with_admin_consent(config: dict) -> dict: params = _build_query(config) params["response_type"] = "adminconsent" - params["credential_id"] = config["credentialId"] + + if "credential_id" in config: + params["credential_id"] = config["credential_id"] return params