+ Start a Discussion
asadimasadim 

URGENT: Cannot login to clients using Office Toolkit

Hi,

 

I'm using the Sforce Office Toolkit and I get the following error when I try logging into a client's system:

INVALID_LOGIN: Invalid username, password, security token; or user locked out.

 

I can login to our developer accounts just fine -it's only the clients that don't work. The credentials that I'm using are 100% correct.

 

Any ideas?

Best Answer chosen by Admin (Salesforce Developers) 
asadimasadim

An intersting update! I'll just let the code speak for itself:

 

I can login to user XYZ like this just fine:

 

string user = "XYZ";
string pass = "XYZpasstoken";
try
{
bool l = _sfapi.Login(user, pass);
if (!l) MessageBox.Show(_sfapi.ErrorMessage);
else MessageBox.Show("yay");
}
catch (Exception e) { MessageBox.Show(e.Message); }

 

On the other hand this logs user ABC in ok however XYZ cannot login now:

string user = "ABC";
string pass = "ABCpasstoken";
try
{
bool l = _sfapi.Login(user, pass);
if (!l) MessageBox.Show(_sfapi.ErrorMessage);
else MessageBox.Show("yay");
}
catch (Exception e) { MessageBox.Show(e.Message); }

user = "XYZ";
pass = "XYZpasstoken";
try
{
bool l = _sfapi.Login(user, pass);
if (!l) MessageBox.Show(_sfapi.ErrorMessage);
else MessageBox.Show("yay");
}
catch (Exception e) { MessageBox.Show(e.Message); }

 The second login attempt fails with the same message as what I had in my initial post.

 

Strange eh?!


 

FINAL UPDATE: Re-initializing _sfapi right before re-logging in with XYZ solved the issue!!

Message Edited by asadim on 03-29-2010 01:14 PM

All Answers

RickNTARickNTA
There aren't many details here so your situation isn't real clear to me - so I'll ask the obvious question: you are using a security token, right?
asadim2asadim2

Hi, yes I'm using password+token to login like this:

 

 

bool isLoggedIn = _sfapi.Login(user, passtoken);

 

 Any ideas? I have this entire add-in developed and now I can't login to a client's system! (been testing it with our dev accounts) Thanks.

 

RickNTARickNTA
I'm still just grasping at straws, but you do realize the token is unique to the user and machine (at least I'm pretty sure it is)?  So, for example, have you tried getting a new token for a user and testing with that?  I find tokens just need to be refreshed occasionally; not usually clear why to me.
asadim2asadim2

I'm not sure about the token being unique to the machine because I can login to the client's account through the Eclipse plugin using the same password and token. Not only that, I can also login to the client's system thru the DataLoader.

 

I really hope you're right tho! Maybe the Eclipse plugin or the DataLoader does some weird stuff behind the curtains. Unfortunately I cannot test this over the weekend and I need to at least have an answer by Monday!!

 

Thanks alot Rick for helping out!

Message Edited by asadim2 on 03-27-2010 08:04 PM
asadimasadim
So another update: I have found one of our developer accounts not able to login either. So my initial assumption is now invalid.
RickNTARickNTA
Sorry I keep not having time to look this up, but I keep thinking you may be having a problem with the token.  I think you're right, it's not machine-specific, but I believe it's either location-specific or there's some other complication related to location (so it might work from your shop but not your client's, etc.).  It's been a couple of years since I researched it so I don't recall all the factors.  One problem I think we hit was our client had access to their SFDC org restricted to specific IP ranges.  But again, I may just be throwing you off track!  HTH...
asadimasadim

Thanks -even if your idea seems to throw me off track I still appreciate it. Better to discuss than being completely clueless!

 

Btw I just did another test and here's the result: I managed to login with a client account last night from my home computer but I can't login with it on any of the work machines. So I think the region-specific hypothesis is not valid.

 

Thanks again for trying to help out. Please do respond if you happen to have other thoughts.

asadimasadim

An intersting update! I'll just let the code speak for itself:

 

I can login to user XYZ like this just fine:

 

string user = "XYZ";
string pass = "XYZpasstoken";
try
{
bool l = _sfapi.Login(user, pass);
if (!l) MessageBox.Show(_sfapi.ErrorMessage);
else MessageBox.Show("yay");
}
catch (Exception e) { MessageBox.Show(e.Message); }

 

On the other hand this logs user ABC in ok however XYZ cannot login now:

string user = "ABC";
string pass = "ABCpasstoken";
try
{
bool l = _sfapi.Login(user, pass);
if (!l) MessageBox.Show(_sfapi.ErrorMessage);
else MessageBox.Show("yay");
}
catch (Exception e) { MessageBox.Show(e.Message); }

user = "XYZ";
pass = "XYZpasstoken";
try
{
bool l = _sfapi.Login(user, pass);
if (!l) MessageBox.Show(_sfapi.ErrorMessage);
else MessageBox.Show("yay");
}
catch (Exception e) { MessageBox.Show(e.Message); }

 The second login attempt fails with the same message as what I had in my initial post.

 

Strange eh?!


 

FINAL UPDATE: Re-initializing _sfapi right before re-logging in with XYZ solved the issue!!

Message Edited by asadim on 03-29-2010 01:14 PM
This was selected as the best answer