Skip to content

Commit feb0f0d

Browse files
authored
Merge pull request #1038 from airweave-ai/feat/scopes_on_refresh
include correct scopes for attlassian during token refresh
2 parents f61f339 + 853259d commit feb0f0d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

backend/airweave/platform/auth/oauth2_service.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,23 @@ def _prepare_token_request(
539539
"refresh_token": refresh_token,
540540
}
541541

542+
# Include scope in refresh request if available
543+
# This ensures the refreshed token maintains the same permissions
544+
if hasattr(integration_config, "scope") and integration_config.scope:
545+
payload["scope"] = integration_config.scope
546+
logger.debug(f"Including scope in token refresh: {integration_config.scope}")
547+
548+
# Include additional_frontend_params (e.g., audience for Atlassian)
549+
# These are often required for the refreshed token to access the same resources
550+
if (
551+
hasattr(integration_config, "additional_frontend_params")
552+
and integration_config.additional_frontend_params
553+
):
554+
payload.update(integration_config.additional_frontend_params)
555+
logger.debug(
556+
f"Including additional params in token refresh: {list(integration_config.additional_frontend_params.keys())}"
557+
)
558+
542559
if integration_config.client_credential_location == "header":
543560
encoded_credentials = OAuth2Service._encode_client_credentials(client_id, client_secret)
544561
headers["Authorization"] = f"Basic {encoded_credentials}"

0 commit comments

Comments
 (0)