xinyiZzz opened a new issue, #37824: URL: https://github.com/apache/arrow/issues/37824
### Describe the usage question you have. Please include as many useful details as possible. I implemented a set of Flight Sql Server and connected with python ADBC: <img width="870" alt="image" src="https://github.com/apache/arrow/assets/13197424/e8259ea6-bcff-4364-994c-a02d95f53e41"> ## ADBC Client While fetch data from flight server B, I got an authentication error: ``` Traceback (most recent call last): File "/app/c.py", line 142, in <module> pandas_data = cursor2.fetch_df() File "/opt/bitnami/python/lib/python3.9/site-packages/adbc_driver_manager/dbapi.py", line 927, in fetch_df return self._results.fetch_df() File "/opt/bitnami/python/lib/python3.9/site-packages/adbc_driver_manager/dbapi.py", line 1016, in fetch_df return self._reader.read_pandas() File "pyarrow/ipc.pxi", line 613, in pyarrow.lib._ReadPandasMixin.read_pandas File "pyarrow/ipc.pxi", line 754, in pyarrow.lib.RecordBatchReader.read_all File "pyarrow/error.pxi", line 115, in pyarrow.lib.check_status OSError: Unauthenticated: SqlState: ``` code: ``` conn = flight_sql.connect(uri="grpc://xxxx:10478", db_kwargs={ adbc_driver_manager.DatabaseOptions.USERNAME.value: "root", adbc_driver_manager.DatabaseOptions.PASSWORD.value: "", }) cursor = conn.cursor() cursor.execute(sql) pandas_data = cursor2.fetch_df() ``` I tried other ways, use Low-Level API, same error: ``` Traceback (most recent call last): File "/app/c.py", line 22, in <module> arrow_data = reader.read_all() File "pyarrow/ipc.pxi", line 754, in pyarrow.lib.RecordBatchReader.read_all File "pyarrow/error.pxi", line 115, in pyarrow.lib.check_status OSError: Unauthenticated: SqlState: ``` code: ``` db = adbc_driver_flightsql.connect(uri="grpc://xxx:10478", db_kwargs={ adbc_driver_manager.DatabaseOptions.USERNAME.value: "root", adbc_driver_manager.DatabaseOptions.PASSWORD.value: "", }) conn = adbc_driver_manager.AdbcConnection(db) stmt = adbc_driver_manager.AdbcStatement(conn) stmt.set_sql_query("select * from tpch.hdf5 limit 1000000;") stream, rows = stmt.execute_query() reader = pyarrow.RecordBatchReader._import_from_c(stream.address) arrow_data = reader.read_all() ``` and, another way: ``` Traceback (most recent call last): File "/app/c.py", line 18, in <module> cursor.adbc_read_partition(partitions[0]) File "/opt/bitnami/python/lib/python3.9/site-packages/adbc_driver_manager/dbapi.py", line 848, in adbc_read_partition handle = self._conn._conn.read_partition(partition) File "adbc_driver_manager/_lib.pyx", line 817, in adbc_driver_manager._lib.AdbcConnection.read_partition File "adbc_driver_manager/_lib.pyx", line 399, in adbc_driver_manager._lib.check_error adbc_driver_manager.ProgrammingError: UNAUTHENTICATED: [FlightSQL] flight: no authorization header on the response ``` ``` conn = flight_sql.connect(uri="grpc://xxx:10478", db_kwargs={ adbc_driver_manager.DatabaseOptions.USERNAME.value: "root", adbc_driver_manager.DatabaseOptions.PASSWORD.value: "", }) cursor = conn.cursor() partitions, schema = cursor.adbc_execute_partitions("select * from tpch.hdf5 limit 10;") cursor.adbc_read_partition(partitions[0]) arrow_data = cursor.fetchallarrow() ``` ## Flight Server B `ServerAuthHandler` implementation in c++, this is an empty Handler, same as using `NoOpAuthHandler`. ``` class FlightSqlServerAuthHandler : public arrow::flight::ServerAuthHandler { public: arrow::Status Authenticate(const arrow::flight::ServerCallContext& context, arrow::flight::ServerAuthSender* outgoing, arrow::flight::ServerAuthReader* incoming) override { return arrow::Status::OK(); } arrow::Status IsValid(const arrow::flight::ServerCallContext& context, const std::string& token, std::string* peer_identity) override { *peer_identity = token; return arrow::Status::OK(); } }; server.cpp flight_options.auth_handler = std::make_unique<FlightSqlServerAuthHandler>(); // flight_options.auth_handler = std::make_unique<arrow::flight::NoOpAuthHandler>(); ``` I think I should implement auth2 in c++, use `ServerCallContext` put `authorization` in header, but I don't know how to do it. I'm looking for help, thanks! ### Component(s) FlightRPC -- 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: issues-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org