ozerpekozcan opened a new issue, #48798:
URL: https://github.com/apache/airflow/issues/48798

   ### Description
   
   Hi,
   
   Currently, Airflow supports simple HTTP authentication. However, it would be 
beneficial to have built-in OAuth authentication, where the token URL, scope, 
and other HTTP parameters can be extracted from the connection. This would 
allow authentication using a token before making requests to the actual 
endpoint.
   
   Additionally, if the token is expired, Airflow should automatically fetch a 
new one to prevent timeout errors. The implementation should retain all 
features of HttpOperator and HttpSensor, including support for deferrable 
execution.
   
   This enhancement would improve security and reliability when integrating 
with OAuth-protected APIs.
   
   Thanks,
   Ozer
   
   ### Use case/motivation
   
   A customizable OAuth authentication mechanism would allow Airflow users to:
   
   - Define OAuth-specific parameters in Airflow Connections (e.g., token URL, 
scopes, client ID, client secret, grant type).
   - Automatically handle token renewal when expired, avoiding job failures.
   - Support both synchronous and deferrable execution, improving resource 
efficiency.
   - Extend the existing HttpHook, HttpOperator, and HttpSensor to support 
OAuth-based authentication without altering existing API logic.
   
   
   Motivation: 
   
   - Standardization – A unified OAuth authentication method ensures 
consistency across different APIs without custom coding for each integration.
   - Security – Storing OAuth credentials securely in Airflow Connections 
reduces exposure and enhances compliance with security policies.
   - Reduced Operational Overhead – Automating token retrieval and refresh 
eliminates the need for manual token management in DAGs.
   - Deferrable Execution Support – Avoids resource-intensive polling by 
deferring execution while waiting for authentication responses.
   - Scalability – Easily extendable to new APIs by simply updating connection 
details instead of modifying DAG logic.
   
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to