File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
backend/airweave/platform/auth Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff 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 } "
You can’t perform that action at this time.
0 commit comments