Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Not able to get Persona authentication working #10

Closed
PaulCapestany opened this issue Apr 3, 2013 · 4 comments
Closed

Not able to get Persona authentication working #10

PaulCapestany opened this issue Apr 3, 2013 · 4 comments

Comments

@PaulCapestany
Copy link

I can't seem to get Persona authentication working — though I'm not sure if it's something on my end or what..

I'm trying this out with a real Couchbase bucket since I've already had success running multiple apps that way. I added the sync function that was provided to my own json config file (gist). Yet when I run sync_gateway -personaOrigin="http://localhost:4984/" myconfig.json, while I'm seemingly able to log in with Persona on the actual iOS app, I can't set up any chats.

This is what I see in my sync_gateway logs:

23:10:11.849476 Opening Couchbase database couchchat on <http://localhost:8091>
23:10:11.930319 Connected to <http://localhost:8091>, pool default, bucket couchchat
23:10:11.951226 Auth: Saved user:: {"admin_channels":null,"all_channels":null,"disabled":true}
23:10:11.951237 Reset guest user to config
23:10:11.952005 Starting auth server on :4985
23:10:11.952351 Starting server on :4984 ...
23:18:09.899723 HTTP: GET /couchchat/_local/fbff5a95fd68dd1257bf38f2533294fc2b116788
23:18:09.900294 HTTP: GET /couchchat/_local/b240451141abfa19e44fcc02ba9a46ea0b096f34
23:18:09.919832 CRUD: Computed channels for "": {}
23:18:09.919941 CRUD: Computed channels for "": {}
23:18:09.920099 Auth failed for username="", cookie=<nil>
23:18:09.920155 HTTP:     --> 401 Invalid login
23:18:09.920376 Auth failed for username="", cookie=<nil>
23:18:09.920420 HTTP:     --> 401 Invalid login
23:18:09.963342 HTTP: GET /couchchat/_local/fbff5a95fd68dd1257bf38f2533294fc2b116788
23:18:09.963719 HTTP: GET /couchchat/_local/b240451141abfa19e44fcc02ba9a46ea0b096f34
23:18:09.963955 Auth failed for username="", cookie=<nil>
23:18:09.964052 HTTP:     --> 401 Invalid login
23:18:09.964355 Auth failed for username="", cookie=<nil>
23:18:09.964407 HTTP:     --> 401 Invalid login

I've tried quite a few different configurations but haven't been able to get any to work, not sure what I'm missing?

@snej
Copy link
Contributor

snej commented Apr 3, 2013

Hm, looks like the client isn't even attempting a Persona login, else your server logs would be showing a POST to /couchchat/_persona.

If you turn on SyncVerbose logging in the client, there'll be a message of the form "Logging in with CBLPersonaAuthorizer at..." when it tries the login. Probably that won't show up since apparently it isn't even getting to that point; but the client logs would be useful to look at.

@PaulCapestany
Copy link
Author

This is what I see when I turn SyncVerbose logging on:

2013-04-03 11:36:07.608 CouchChat[3226:c07] SYNCMGR: active=1; mode=3; 0/0; (null)
2013-04-03 11:36:07.949 CouchChat[3226:c07] SYNCMGR: active=1; mode=3; 0/0; 401 unauthorized
2013-04-03 11:36:07.950 CouchChat[3226:c07] SYNCMGR: active=0; mode=2; 0/0; 401 unauthorized
2013-04-03 11:37:09.590 CouchChat[3226:c07] SYNCMGR: active=0; mode=0; 0/0; 401 unauthorized
2013-04-03 11:37:09.593 CouchChat[3226:c07] Warning: Attempt to present <UINavigationController: 0x8c82d30> on <UINavigationController: 0x8c3b7e0> while a presentation is in progress!
2013-04-03 11:37:09.593 CouchChat[3226:c07] SYNCMGR: active=1; mode=3; 0/0; 401 unauthorized
2013-04-03 11:37:09.593 CouchChat[3226:c07] SYNCMGR: active=1; mode=3; 0/0; (null)
2013-04-03 11:37:09.630 CouchChat[3226:c07] SYNCMGR: active=1; mode=3; 0/0; 404 not_found
2013-04-03 11:37:09.631 CouchChat[3226:c07] Chat username = 'capestany@gmail.com'
2013-04-03 11:37:09.631 CouchChat[3226:c07] Setting chat username to 'capestany@gmail.com'
2013-04-03 11:37:09.632 CouchChat[3226:c07] Created user profile UserProfile[prof...com]
2013-04-03 11:37:09.634 CouchChat[3226:c07] SYNCMGR: active=0; mode=2; 0/0; 404 not_found

@snej
Copy link
Contributor

snej commented Apr 3, 2013

This is what I see when I turn SyncVerbose logging on:

Hm, that output doesn’t show any logs from CBL, only the NSLogs from the chat app itself.

2013-04-03 11:37:09.593 CouchChat[3226:c07] SYNCMGR: active=1; mode=3; 0/0; (null)
2013-04-03 11:37:09.630 CouchChat[3226:c07] SYNCMGR: active=1; mode=3; 0/0; 404 not_found

The 404 makes me suspect you may have a mismatch between versions of CBL and the sync gateway. The API endpoint for Persona login changed from /_persona to /dbname/_persona a few weeks ago — if you have an older version of one or the other project, the login will fail with a 404.

@PaulCapestany
Copy link
Author

Oops, I totally forgot that I needed to add -Log YES in order for LogSyncVerbose to actually do its thing — sorry about that! No wonder I was having issues figuring out what was going on...

Either way, I did finally get everything to work ☺

Just a heads up to anyone that may face similar issues: the Persona auth stuff seemed to only work for me after I got rid of all my previous Couchbase buckets. I'm not sure if there may have been some kinda conflict with the way the old buckets dealt with handling the sessions/Persona/etc stuff in the past that prevented things from working with the more recent commits or what — but basically starting everything as if from scratch is what did the trick for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants