Monitoring Authentication

25 views
Skip to first unread message

Todd Freese

unread,
Aug 29, 2014, 12:40:28 PM8/29/14
to mobile-c...@googlegroups.com
What is the best way to monitor whether a replication to SG authenticated or not? The replicator status codes don't have a code for authentication error.

I am using NSURLCredential with CBL on iOS.

Todd

Jens Alfke

unread,
Aug 29, 2014, 1:32:57 PM8/29/14
to mobile-c...@googlegroups.com

> On Aug 29, 2014, at 9:40 AM, Todd Freese <to...@filmworkers.com> wrote:
>
> What is the best way to monitor whether a replication to SG authenticated or not? The replicator status codes don't have a code for authentication error.

The status will report an error and the lastError property will be set to an NSError with code 401 (Unauthorized).

—Jens

Todd Freese

unread,
Aug 29, 2014, 3:22:00 PM8/29/14
to mobile-c...@googlegroups.com
I'm getting the error in status, but lastError is always null. This was working before I started using credentials. If I switch back to putting the username and password in the URL, I get the correct 401 error in lastError.

Todd

Jens Alfke

unread,
Aug 29, 2014, 5:17:09 PM8/29/14
to mobile-c...@googlegroups.com

On Aug 29, 2014, at 12:22 PM, Todd Freese <to...@filmworkers.com> wrote:

I'm getting the error in status, but lastError is always null. This was working before I started using credentials. If I switch back to putting the username and password in the URL, I get the correct 401 error in lastError.

By "using credentials" what do you mean, exactly?

If the replication status says there's an error but the lastError property is nil, that's a bug; could you file a bug report, please? And if possible, turn on SyncVerbose logging and upload the log to a gist.

—Jens

Todd Freese

unread,
Aug 29, 2014, 6:01:27 PM8/29/14
to mobile-c...@googlegroups.com
My credential, I mean I am passing an NSURLCreditial into the replicator.

    _pull = [self.database createPullReplication:[NSURL URLWithString:cblSyncURL]];

    _pull.credential = credential;

    

    _push = [self.database createPushReplication:[NSURL URLWithString:cblSyncURL]];

    _push.credential = credential;


Looks like it is a bug as it is reproducible. And if I don't use an NSURLCredential and instead pass the username and password in the URL, it works fine.


I will file a bug.


Todd

Todd Freese

unread,
Aug 29, 2014, 6:14:50 PM8/29/14
to mobile-c...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages