@@ -49,10 +49,11 @@ type SQCloudConfig struct {
4949 TlsInsecureSkipVerify bool // Accept invalid TLS certificates (no_verify_certificate)
5050 Pem string
5151 ApiKey string
52- NoBlob bool // flag to tell the server to not send BLOB columns
53- MaxData int // value to tell the server to not send columns with more than max_data bytes
54- MaxRows int // value to control rowset chunks based on the number of rows
55- MaxRowset int // value to control the maximum allowed size for a rowset
52+ Token string // Access Token for authentication
53+ NoBlob bool // flag to tell the server to not send BLOB columns
54+ MaxData int // value to tell the server to not send columns with more than max_data bytes
55+ MaxRows int // value to control rowset chunks based on the number of rows
56+ MaxRowset int // value to control the maximum allowed size for a rowset
5657}
5758
5859type SQCloud struct {
@@ -131,6 +132,7 @@ func ParseConnectionString(ConnectionString string) (config *SQCloudConfig, err
131132 config .MaxRows = 0
132133 config .MaxRowset = 0
133134 config .ApiKey = ""
135+ config .Token = ""
134136
135137 sPort := strings .TrimSpace (u .Port ())
136138 if len (sPort ) > 0 {
@@ -195,6 +197,8 @@ func ParseConnectionString(ConnectionString string) (config *SQCloudConfig, err
195197 config .Secure , config .TlsInsecureSkipVerify , config .Pem = ParseTlsString (lastLiteral )
196198 case "apikey" :
197199 config .ApiKey = lastLiteral
200+ case "token" :
201+ config .Token = lastLiteral
198202 case "noblob" :
199203 if b , err := parseBool (lastLiteral , config .NoBlob ); err == nil {
200204 config .NoBlob = b
@@ -434,12 +438,14 @@ func connectionCommands(config SQCloudConfig) (string, []interface{}) {
434438 }
435439
436440 if config .ApiKey != "" {
437- c , a := authWithKeyCommand (config .ApiKey )
441+ c , a := authWithApiKeyCommand (config .ApiKey )
438442 buffer += c
439443 args = append (args , a ... )
440- }
441-
442- if config .Username != "" && config .Password != "" {
444+ } else if config .Token != "" {
445+ c , a := authWithTokenCommand (config .Token )
446+ buffer += c
447+ args = append (args , a ... )
448+ } else if config .Username != "" && config .Password != "" {
443449 c , a := authCommand (config .Username , config .Password , config .PasswordHashed )
444450 buffer += c
445451 args = append (args , a ... )
0 commit comments