xborder commented on code in PR #2651:
URL: https://github.com/apache/arrow-adbc/pull/2651#discussion_r2031373798


##########
go/adbc/driver/flightsql/flightsql_database.go:
##########
@@ -387,7 +453,19 @@ func getFlightClient(ctx context.Context, loc string, d 
*databaseImpl, authMiddl
        if len(authMiddle.hdrs.Get("authorization")) > 0 {
                d.Logger.DebugContext(ctx, "reusing auth token", "location", 
loc)
        } else {
-               if d.user != "" || d.pass != "" {
+               if d.token != "" {
+                       authMiddle.mutex.Lock()
+                       defer authMiddle.mutex.Unlock()
+                       authMiddle.hdrs.Set("authorization", "Bearer "+d.token)
+               } else if d.oauthFlow != nil {
+                       token, err := d.oauthFlow.GetToken(ctx)
+                       if err != nil {
+                               return nil, 
adbcFromFlightStatusWithDetails(err, nil, nil, "Authenticate Oauth")
+                       }
+                       authMiddle.mutex.Lock()
+                       defer authMiddle.mutex.Unlock()
+                       authMiddle.hdrs.Set("authorization", "Bearer 
"+token.AccessToken)

Review Comment:
   done



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to