Comments (10)
I think this is probably related to issue #51 on sync_gateway, I have two DB's defined, everything works fine in guest mode but breaks with Persona auth on.
from couchbase-lite-ios.
I'm going to close this issue and let it be handled over on the sync_gateway issue list under #51. If I have problems syncing with a single DB I'll raise a new issue here.
from couchbase-lite-ios.
CBL seems to be trying to access the /_session without the DB prefix.
That means you have an older version of CBL from before we moved the _persona endpoint on the server side.
from couchbase-lite-ios.
Jens
Hi, I have something that claims to be a Person build, the framework header CBLReplication.h contains, I rebuilt the Framework twice as that was my first thought, I also visually checked that some of the latest mods were present.
I have moved to one DB now and I am getting a lot more traffic but still no Persona login, I'm still digging.
Andy
/** The base URL of the remote server, for use as the "origin" parameter when requesting Persona authentication. /
@Property (readonly) NSURL personaOrigin;
/** Email address for remote login with Persona (aka BrowserID). This is stored persistently in
the replication document, but it's not sufficient for login (you also need to go through the
Persona protocol to get a signed assertion, which you then pass to the
-registerPersonaAssertion: method.)/
@Property (nonatomic, copy) NSString personaEmailAddress;
/** Registers a Persona 'assertion' (ID verification) string that will be used on the next login to the remote server. This also sets personaEmailAddress.
Note: An assertion is a type of certificate and typically has a very short lifespan (like, a
few minutes.) For this reason it's not stored in the replication document, but instead kept
in an in-memory registry private to the Persona authorizer. You should initiate a replication
immediately after registering the assertion, so that the replicator engine can use it to
authenticate before it expires. After that, the replicator will have a login session cookie
that should last significantly longer before needing to be renewed. */
- (bool) registerPersonaAssertion: (NSString*)assertion attribute((nonnull));
from couchbase-lite-ios.
Ah, I just noticed you said _session
not _persona
.
Looking at the code, CBLReplicator still access /_session
to check for an existing login cookie. The sync gateway handles this endpoint as long as there's only a single db; but if there are multiple dbs it doesn't, because it's ambiguous which one is meant. Thus your error.
Crap, not sure what to do about this, since the replicator does need to be compatible with CouchDB as well. Let me think...
from couchbase-lite-ios.
Could you provide an aggregate set of sessions on /_session (from all active DB's) assuming session ID's a GUIDS
from couchbase-lite-ios.
Here's a patch that will fall back to /db/_session if /_session isn't found. Could you try it out?
diff --git a/Source/CBL_Replicator.m b/Source/CBL_Replicator.m
index d1ae714..b8f34ad 100644
--- a/Source/CBL_Replicator.m
+++ b/Source/CBL_Replicator.m
@@ -484,14 +484,22 @@ NSString* CBL_ReplicatorStoppedNotification = @"CBL_ReplicatorStopped";
[self fetchRemoteCheckpointDoc];
return;
}
+ [self checkSessionAtPath: @"/_session"];
+}
+- (void) checkSessionAtPath: (NSString*)sessionPath {
// First check whether a session exists
[self asyncTaskStarted];
[self sendAsyncRequest: @"GET"
- path: @"/_session"
+ path: sessionPath
body: nil
onCompletion: ^(id result, NSError *error) {
if (error) {
+ // CouchDB has /_session, but the Sync Gateway uses /db/_session
+ if (error.code == kCBLStatusNotFound && $equal(sessionPath, @"/_session")) {
+ [self checkSessionAtPath: @"_session"];
+ return;
+ }
LogTo(Sync, @"%@: Session check failed: %@", self, error);
self.error = error;
} else {
from couchbase-lite-ios.
Jens
I can't do a complete end-to-end test at the moment as my Persona auth is broken for one DB, but you can see the first two sync_gateway entries below indicate that the db/_session URL was called.
Once I figure out what's wrong with my Persona login I'll do a full two DB test with the patch.
21:54:06.260931 HTTP: GET /mydb/_session
21:54:06.261353 HTTP: GET /mydb/_session
from couchbase-lite-ios.
OK, thanks. I'll commit the change since it does seem to have helped.
from couchbase-lite-ios.
I have fixed my Persona Auth issue, I'll probably generate a pull request in the next couple of days, but it has allowed me to test against sync_gateway with two DB's and the client both authenticates with one of the two DB's and syncs with it (only push to sync_gateway covered in test).
from couchbase-lite-ios.
Related Issues (20)
- `valueWouldChange` does not check whether `newValue` is a `CBLDictionary` HOT 1
- `ArrayFunction.contains` does not evaluate to correct result for boolean values HOT 2
- Module compiled with Swift 5.3.2 cannot be imported by the Swift 5.5 compiler HOT 6
- CouchbaseLite-Swift-Enterprise pod produces warning when compiling with Xcode 13 HOT 8
- Sync crashing CB lite 2.8.0 Ios 15.1 HOT 3
- Compiling issue after upgrading to Xcode 13.2.1 HOT 1
- Fleece crash during document retrieval HOT 12
- `ExpressionProtocol.isNotValued` and `isValued` functions are not available HOT 1
- setMapBlock is executing for all CBLView s instead of specific mentioned CBLView HOT 4
- Add Support for Combine Publishers HOT 1
- Add Linux Support HOT 5
- Add Nulls Ordering support HOT 2
- CouchbaseLite includes UIWebView, can it be changed to WKWebView? HOT 2
- Undefined symbol: _CBLVersion HOT 1
- “CouchbaseLiteSwift.framework” cannot be opened because the developer cannot be verified. HOT 3
- 【iOS Swift】CouchbaseLite Replicator ERROR: {Repl#935} Got LiteCore error: WebSocket error 1006, "connection closed abnormally" HOT 2
- Undefined symbols for CBLReplicatedDocument using CBL ObjC HOT 1
- After downloading the demo, it cannot be run. HOT 2
- Crash on `Query.removeChangeListener(withToken:)` HOT 14
- Swift Package Manager version of CouchbaseLiteSwift 3.1.3 crashes on `MutableDocument()` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from couchbase-lite-ios.