File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -891,10 +891,12 @@ func (o *oauth) DoDeviceAuthorization() (*token, error) {
891891 return nil , errors .Wrap (err , "failure decoding device authz response to JSON" )
892892 }
893893
894+ shouldPrintCode := true
894895 switch {
895896 case idr .VerificationURIComplete != "" :
896897 // Prefer VerificationURIComplete if present for user convenience
897898 idr .VerificationURI = idr .VerificationURIComplete
899+ shouldPrintCode = false
898900 case idr .VerificationURI != "" :
899901 // do nothing
900902 case idr .VerificationURL != "" :
@@ -909,8 +911,12 @@ func (o *oauth) DoDeviceAuthorization() (*token, error) {
909911 idr .Interval = defaultDeviceAuthzInterval
910912 }
911913
912- fmt .Fprintf (os .Stderr , "Visit %s and enter the code:\n " , idr .VerificationURI )
913- fmt .Fprintln (os .Stderr , idr .UserCode )
914+ if shouldPrintCode {
915+ fmt .Fprintf (os .Stderr , "Visit %s and enter the code:\n " , idr .VerificationURI )
916+ fmt .Fprintln (os .Stderr , idr .UserCode )
917+ } else {
918+ fmt .Fprintf (os .Stderr , "Visit %s:\n " , idr .VerificationURI )
919+ }
914920
915921 // Poll the Token endpoint until the user completes the flow.
916922 data = url.Values {}
You can’t perform that action at this time.
0 commit comments