User Login

54 views
Skip to first unread message

Jai

unread,
Feb 8, 2012, 12:18:49 PM2/8/12
to cocoafi...@googlegroups.com
Returns 401 when the login request is made second time with the (same) correct credentials of the user already logged in? do we need to send the session id returned in the first call to handle subsequent requests and get a return of 200??? Please suggest. I am testing the login interface for an android app, this is required until I figure out storing the credentials received in the first call on the client side.

Wei Kong

unread,
Feb 8, 2012, 7:00:56 PM2/8/12
to cocoafi...@googlegroups.com
What is the error message associated with it? Can you send us the exact api calls you made?

Thanks,
Wei

February 8, 2012 9:18 AM

David Pan

unread,
Feb 9, 2012, 8:52:42 PM2/9/12
to cocoafi...@googlegroups.com
I may be misunderstanding your issue so sorry if this sounds stupid, but I'm guessing you're issue is related to how the SDK manages sessions.

http://www.cocoafish.com/docs/quickstart#session

I'm no expert on the Cocoafish SDK, but perhaps you need to log out of the user in order to successfully log in again.  The Cocoafish SDK seems to manage the session for you and stores the current user's information in a CCUser object internally (which is essentially what's returned in the response from a login call anyway). 

Anyway, I think most apps would do something like

if(YourCocoafishSDK.getCurrentUser() == null){
    Show login screen
}
else{
    Do something else
}

If you are only testing the login screen, I suppose you could perform a logout every time your application is started.

PS:

The quickstart section offers a Class definition for CCUser but seems to be incorrectly  labeled as CCResponse so don't get confused by that.

Raz

unread,
Feb 14, 2012, 10:32:57 PM2/14/12
to cocoafi...@googlegroups.com
I also get an error mine says

meta: { stat: fail, code:401, message: 401 unauthorized request}

Thing is I have valid API and I could use nonuser requried called with parameters no proble, but as soon as I use login and password parameters with correct user name and password, I am getting the above error, what could be the issue? 

Raz

unread,
Feb 14, 2012, 10:36:12 PM2/14/12
to cocoafi...@googlegroups.com
Actually nevermind! Just figured out the mistakes (on my part)

Congrats on appcelerator. Please don't stop development/improvement on cocoafish. 

Jai

unread,
Feb 17, 2012, 12:35:04 PM2/17/12
to cocoafi...@googlegroups.com

Sorry all getting back late. Its my part time work I do for app development. Actually, the issue is if the APP owner credentials are used for logging in second time, that it gives 401. With the same code, if you use the any users credentials as created in users table there is no problem. Hope this helps to any one.

I have another question, I tried to create place, API did no not give any status code OR message. I know there are some missing fields below, however it should give some status code for better error handling.

2012-02-17 06:42:14 UTC
Request Name POST /v1/places/create.json
Parameters { "state" => "VA", "country" => "USA", "city" => "Herndon", "name" => "my location", "key" => "XXXXXXXXXXXXXXX", "controller" => "places", "action" => "create", "version" => "v1", "format" => "json" }

Please note that, I am posting them as I encounter so that the team knows. Its a great tool, I am waiting for the relational query implementation. I am almost done with my API queries and creations for my titanium APP. I need to do more on relational queries between standard tables and custom tables and its relations.

Thanks to all for the responses on earlier issue.
Have a nice weekend and happy coding!!


Reply all
Reply to author
Forward
0 new messages