func TryLogIn(instance *Instance) (err error) { url := "" if instance.Sandbox { url = sandboxURL } else { url = productionURL } url += instance.Version auth := new(partner.Login) auth.Username = instance.UserInfo.Username auth.Password = instance.UserInfo.Password + instance.UserInfo.Token client := partner.NewSoap(url, true, nil) resp, err := client.Login(auth) if err != nil { return } instance.UserInfo.SessionID = resp.Result.SessionId instance.MetadataURL = resp.Result.MetadataServerUrl instance.ServerURL = resp.Result.ServerUrl err = instance.SaveInstance() return }
func TryLogIn(url, username, password, token string) (sessionId string, err error) { logInClient := partner.NewSoap(url, true, nil) loginInfo := new(partner.Login) loginInfo.Username = username loginInfo.Password = password + token resp, err := logInClient.Login(loginInfo) if err != nil { return } sessionId = resp.Result.SessionId return }