gosnowflake icon indicating copy to clipboard operation
gosnowflake copied to clipboard

SNOW-588465: 390100 (08004): Incorrect username or password was specified

Open zegenerative opened this issue 2 years ago • 2 comments

Unable to login with credentials that are identical to credentials to successfully login online/browser

Example code

connectionString := fmt.Sprintf("%v:%v@%v/%v?warehouse=%v&role=%v", user, password, account, dbName, warehouse, role)
db, err := sql.Open("snowflake", connectionString)

user is in the form of [email protected] password has upper/lowercase letters, includes a '+' symbol they are correctly being read from a .env file

Error log

ERRO[0000]log.go:242 gosnowflake.(*defaultLogger).Errorln Authentication FAILED                        
<nil>
2022/05/11 13:37:48 390100 (08004): Incorrect username or password was specified.
exit status 1

Configuration

Go version: 1.18 darwin/arm64

zegenerative avatar May 11 '22 12:05 zegenerative

Hi @zegenerative . I'm a fellow user too. I use the following code to connect. Personally I have avoided creating the connection strings by myself. Maybe you can give this a try?

Code isn't the best, I just copy pasted from my personal repo.

var sfconfig sf.Config
var sf_con_string string
var db *sql.DB

func init() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	params := make(map[string]*string)
	valueTrue := "true"
	params["client_session_keep_alive"] = &valueTrue

	sfconfig.User = os.Getenv("SNOWUSERNAME")
	sfconfig.Password = os.Getenv("SNOWPASSWORD")
	sfconfig.Warehouse = os.Getenv("SNOWWAREHOUSE")
	sfconfig.Role = os.Getenv("SNOWROLE")
	sfconfig.Account = os.Getenv("SNOWACCOUNT")
	sfconfig.Params = params
	sf_con_string, _ = sf.DSN(&sfconfig)
	db, err = sql.Open("snowflake", sf_con_string)
	if err != nil {
		log.Println("Error connecting to snowflake")
		log.Fatal(err)
	}
	if err = db.Ping(); err != nil {
		log.Println("Error pinging snowflake")
		log.Fatal(err)
	}

}

kishvanchee avatar May 17 '22 17:05 kishvanchee

I've been having this issue as well:

config := gosnowflake.Config{
	Account:   fmt.Sprintf("%s-%s", organization, account),
	User:      username,
	Password:  password,
	Database:  database,
	Schema:    schema,
	Warehouse: warehouse,
}

connStr, err := gosnowflake.DSN(&config)
if err != nil {
    return nil, err
}

db, err := sql.Open("snowflake", connStr)
if err != nil {
	return nil, err
}

Woody1193 avatar Aug 02 '22 07:08 Woody1193

hi, thank you for submitting this issue with us. tried to reproduce this issue with a slightly modified version

	account := env("SNOWFLAKE_TEST_ACCOUNT", true)
>>>	user := "[email protected]"
>>>	password := "Pass+w0rd"
	host := env("SNOWFLAKE_TEST_HOST", false)
	portStr := env("SNOWFLAKE_TEST_PORT", false)
	protocol := env("SNOWFLAKE_TEST_PROTOCOL", false)

of the select1.go example program (also modified to select 2..) and it ran perfectly successfully:

$ go run select2.go 
Congrats! You have successfully run SELECT 2 with Snowflake DB!

if the issue still persists, please post a executable reproduction program (of course with the actual credentials removed) and we'll take a look. Enabling debug level logging might also help.

sfc-gh-dszmolka avatar Mar 28 '23 12:03 sfc-gh-dszmolka