Sharashchandra commented on code in PR #47191:
URL: https://github.com/apache/airflow/pull/47191#discussion_r1975084560


##########
providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -185,6 +187,30 @@ def _get_field(self, extra_dict, field_name):
             return extra_dict[field_name] or None
         return extra_dict.get(backcompat_key) or None
 
+    def get_oauth_token(self, conn_config: dict) -> str:
+        """Generate temporary OAuth access token using refresh token in 
connection details."""
+        url = 
f"https://{conn_config['account']}.snowflakecomputing.com/oauth/token-request"
+        data = {
+            "grant_type": "refresh_token",
+            "refresh_token": conn_config["refresh_token"],
+            "redirect_uri": conn_config.get("redirect_uri", 
"https://localhost.com";),

Review Comment:
   Redirect uri is required to fetch access_token using a refresh_token. This 
redirect_uri should match whatever is mentioned while creating a security 
inegration on Snowflake.
   
   We're defaulting to https://localhost.com because that's what is mentioned 
in the Snowflake documentation. 
   
[https://docs.snowflake.com/en/user-guide/oauth-custom#integration-example](Snowflake
 OAuth)



-- 
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