Forum Discussion

anthony's avatar
anthony
Helper
12 years ago

Need the secret to the REST API login method using username/password.

Tried both GET and POST, set "Make REST API calls with read access" to 'grant' for the user, tried with both an Admin user and a basic user...

 

I can execute API calls in a browser after I log in, but when I try via code, middleware and SOAP UI, the login method always returns "User authentication failed" ...I've scoured the docs, the boards and Google and haven't found the magic combination yet. I'm sure it's something simple, but it doesn't seem to be obvious.

 

Thanks,

 

Anthony 

9 Replies

  • anthony's avatar
    anthony
    Helper
    12 years ago
    I'm not sure...I get an "access denied" when I click that link ;) I'll see if I can find access it another way and let you know.
  • anthony's avatar
    anthony
    Helper
    12 years ago
    It looks like I may need support access to see that documentation. We are new to Lithium via an acquisition and I'm trying to get up to speed. Still no luck with access, but I'll keep at it.
  • anthony's avatar
    anthony
    Helper
    12 years ago
    Well...I got access to the link above and unfortunately, it didn't help. It confirmed that I've been doing the correct things, but still getting 'User authentication failed.'

    Via a browser everything is fine if I log into the portal, but with REST API login, no luck. I'm completely stuck and unsure how to proceed. Are there log files or some other indication of what is failing?
  • JasonL's avatar
    JasonL
    Lithium Alumni (Retired)
    12 years ago
    If its possible, can you perhaps share a snaphot of your code?
    (I guess blank out your user creds)
  • anthony's avatar
    anthony
    Helper
    12 years ago

    The code I've used is abstracted Java (ColdFusion), but also Websphere middleware (CastIron - so also Java) and just plain dropping the URL into a browser.

    It does the same thing, regardless which is either a GET:

    http://xxx.xxx.com/restapi/vc/authentication/sessions/login?user.login=xxLoginNamexx&usern.password=xxPasswordxx

     

    [EDIT: Fixed Typo in Link above to represent what I'm actually doing (it had wrong querystring names)]

    or a POST with login and password sent as form fields instead of querystring. According to the docs, this should work, but it doesn't. With the same creds I can log in to the community via browser and execute REST which works for about 75% of my needs, but I need message bodies for a thread, so want to loop through programmatically. If not...it's download each one at a time, which is time consuming and tedious, but possible.

     

    - I suspect it's a setting somewhere or something configuration-wise that I'm not getting, but I haven't found anything beyond what i've tried and don't see how to get to the log files that would give me stack traces or more detailed information.

  • anthony's avatar
    anthony
    Helper
    12 years ago
    Bah. Typo in my post. Sorry about that - I'm actually using user. not username. Too many years of typing username/password :/

    One thing I haven't tried is also passing the authentication method. I'll see if i can find the values for that in the javadocs and give that a whirl.

    I'll update my post above as well to fix that.
  • anthony's avatar
    anthony
    Helper
    12 years ago
    Never did figure this out, so moved on to a manual solution since we didn't have that many posts. I just grabbed the messages manually, saved the xml and then did all my programmatic work on the local files.

    I'm sure there's a magical configuration setting somewhere, or maybe something with SSO, but it was more efficient for me to spend the time pulling the messages than beat my head against the authentication wall.