mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-12-22 21:32:19 -06:00
feat(auth)!: expose access_token and refresh_token at top level of auth credentails
BREAKING CHANGE: `token` attribute of OAuth2Auth credentials used to be a dict containing both access_token and refresh_token, given that may cause confusions, now we replace it with access_token and refresh_token at top level of the auth credentials PiperOrigin-RevId: 750346172
This commit is contained in:
committed by
Copybara-Service
parent
49d8c0fbb2
commit
956fb912e8
@@ -69,7 +69,7 @@ class OAuth2CredentialExchanger(BaseAuthCredentialExchanger):
|
||||
HTTP bearer token cannot be generated, return the original credential.
|
||||
"""
|
||||
|
||||
if "access_token" not in auth_credential.oauth2.token:
|
||||
if not auth_credential.oauth2.access_token:
|
||||
return auth_credential
|
||||
|
||||
# Return the access token as a bearer token.
|
||||
@@ -78,7 +78,7 @@ class OAuth2CredentialExchanger(BaseAuthCredentialExchanger):
|
||||
http=HttpAuth(
|
||||
scheme="bearer",
|
||||
credentials=HttpCredentials(
|
||||
token=auth_credential.oauth2.token["access_token"]
|
||||
token=auth_credential.oauth2.access_token
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -111,7 +111,7 @@ class OAuth2CredentialExchanger(BaseAuthCredentialExchanger):
|
||||
return auth_credential
|
||||
|
||||
# If access token is exchanged, exchange a HTTPBearer token.
|
||||
if auth_credential.oauth2.token:
|
||||
if auth_credential.oauth2.access_token:
|
||||
return self.generate_auth_token(auth_credential)
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user