Is there an Android equivalent of the Persona login UI that exists for iOS

116 views
Skip to first unread message

Brian Hardy

unread,
Apr 7, 2014, 10:07:10 PM4/7/14
to mobile-c...@googlegroups.com


Hi,

Can anyone tell me if there is an Android equivalent of the Persona login UI that exists for iOS.

Can anyone offer any guidance in getting Persona to work with Android?

Thanks

Traun Leyden

unread,
Apr 8, 2014, 1:45:29 PM4/8/14
to mobile-c...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/1ceef560-e973-4dc4-85cd-2e745c5ef2ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Hardy

unread,
Apr 8, 2014, 3:14:31 PM4/8/14
to mobile-c...@googlegroups.com
I found this code from sean monstar that seems promising. I saw it sort of work once or twice but haven't been able to get it to work consistently yet.

Brian Hardy

unread,
Apr 8, 2014, 3:34:34 PM4/8/14
to mobile-c...@googlegroups.com

I found this code from Sean McArthur that seems promising. I saw it sort of work once or twice but haven't been able to get it to work consistently yet.

On Monday, April 7, 2014 7:07:10 PM UTC-7, Brian Hardy wrote:

Brian Hardy

unread,
Apr 8, 2014, 5:11:37 PM4/8/14
to mobile-c...@googlegroups.com
I've looked at that code some more. If I use an email address at yahoo or gmail, I get an error looking like this:
04-08 13:57:37.623: D/LoginActivity(6775): javascript:BrowserID.internal.get('http://myserver', function __personaAndroidCallback(assertion) { __personaAndroid.onAssertion(assertion); });
04-08 13:57:37.913: I/chromium(6775): [INFO:CONSOLE(7)] "Uncaught TypeError: Cannot call method 'getEmailHint' of undefined", source: https://static.login.persona.org/v/bacc16b292/production/en/dialog.js (7)
04-08 13:57:37.944: I/chromium(6775): [INFO:CONSOLE(0)] "Refused to set unsafe header "Connection"", source: https://gmail.login.persona.org/provision (0)
04-08 13:57:38.224: I/chromium(6775): [INFO:CONSOLE(4)] "Uncaught Error: module not started for authenticate", source: https://static.login.persona.org/v/bacc16b292/production/en/dialog.js (4)

If I use an my corporate email, I get to respond via email and generate an assertion without error. I ran a curl command to test the assertion like this

curl -d "assertion=<ASSERTION>&audience=http://mysever" "https://verifier.login.persona.org/verify"

Which seemed to tell me it was ok. I'm not sure why yahoo and gmail don't work. Any ideas?

Thanks

On Monday, April 7, 2014 7:07:10 PM UTC-7, Brian Hardy wrote:

Brian Hardy

unread,
Apr 24, 2014, 5:24:41 PM4/24/14
to mobile-c...@googlegroups.com

I just wanted to let you know Traun, I was able to get Persona on Android working. I used a webview as indicated in other posts here. I did and http post to the _persona endpoint on couchbase using the assertion I got in the web view from hitting the mozilla login.persona url. I got the cookies from that call and stored them with CookieManager. I updated my Replications by adding the cookie as a header replication.addHeader:

CookieManager.getInstance().setCookie(syncUrl, cookie);
CookieManager.getInstance().getCookie(syncUrl, cookie);

pullReplication.getHeaders().put("Cookie", cookie);
pullReplication.setAuthorizer(authorizer);

I used a new Authorizer that returns true for useCookieBasedLogin

class PAuthorizer extends Authorizer {
    @Override
    public boolean usesCookieBasedLogin() {
        return true;
    }
}

This looked like what you had except the method where you update the replication (I believe it was synchronizeWithPersonaAssertion) you were attempting to append a Query string with PersonaAuthorizer.QUERY_PARAMETER, and value assertion. This didn't seen to to anything. Instead you must addHeader to replication and add the cookie as described above.

Note: Persona won't currently work for emails for yahoo or google since the code I used in the WebView does not correctly handle redirect to different IDPs.

Traun Leyden

unread,
Apr 24, 2014, 6:20:45 PM4/24/14
to mobile-c...@googlegroups.com
Thanks for contributing that!

At some point Persona based login will hopefully get added to ToDoLite-Android.  (pull requests welcome)


--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages