File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
1818 "context"
1919 "crypto/x509"
2020 "fmt"
21+ "log"
2122 "net/http"
2223 "os"
2324 "strings"
@@ -441,14 +442,22 @@ func (b *CommandConfigOauth) GetServerConfig() *Server {
441442
442443// RoundTrip executes a single HTTP transaction, adding the OAuth2 token to the request
443444func (t * oauth2Transport ) RoundTrip (req * http.Request ) (* http.Response , error ) {
445+ log .Printf ("[DEBUG] Attempting to get oAuth token from: %s %s" , req .Method , req .URL )
444446 token , err := t .src .Token ()
445447 if err != nil {
446448 return nil , fmt .Errorf ("failed to retrieve OAuth token: %w" , err )
447449 }
448450
451+ if token == nil || token .AccessToken == "" {
452+ return nil , fmt .Errorf ("received empty OAuth token" )
453+ }
454+
449455 // Clone the request to avoid mutating the original
456+ log .Printf ("[DEBUG] Adding oAuth token to request: %s %s" , req .Method , req .URL )
450457 reqCopy := req .Clone (req .Context ())
451458 token .SetAuthHeader (reqCopy )
459+ requestCurlStr , _ := RequestToCurl (reqCopy )
460+ log .Printf ("[DEBUG] curl command: %s" , requestCurlStr )
452461
453462 return t .base .RoundTrip (reqCopy )
454463}
You can’t perform that action at this time.
0 commit comments