I am attempting to authenticate with an exchange server via IMAP, specifically the go-imap library and getting login failed.
c, err := client.DialTLS("mailserver:993", &config)
if err != nil {
panic(err)
}
err = c.Login("username", "password1234")
if err != nil {
panic(err)
}
I am also trying this:
type Credentials struct {
Domain string
Username string
Password string
}
func (c *Credentials) Start() (mech string, ir []byte, err error) {
return "PLAIN", nil, nil
}
func (c *Credentials) Next(challenge []byte) (response []byte, err error) {
fmt.Println("Next: %v
", string(challenge))
return []byte(base64.StdEncoding.EncodeToString([]byte("\000" + c.Username + "\000" + c.Password)), nil
}
I am assuming I must be using the wrong authentication mechanism and need to write that for exchange? I listed the caps and I have GSSAPI, NTLM, PLAIN.
I tried all combinations of domain/username, domain\username, email address, etc.
I also tried to do base64 encoding of the username / password as well as domain\username / password.