On Friday, 5 December 2014 18:13:56 UTC+5:30, Vinay Bhinde wrote:
>
>
> <https://lh5.googleusercontent.com/-GTbZK7iFnic/VIGocewCLXI/AAAAAAAAAhI/bdaRspfewro/s1600/Untitled.png>
>
>
> On Friday, 5 December 2014 00:07:10 UTC+5:30, Traun Leyden wrote:
>>
>> Can you post your sync gateway config?
>>
>> Also, I would suggest disabling guest access, so that way you know 
>> whether it's using the session cookie or not (if it's not, it will get an 
>> error trying to do a replication)
>>
>> On Thu, Dec 4, 2014 at 3:40 AM, Vinay Bhinde <vin...@gmail.com> wrote:
>>
>>> Hello All,
>>>
>>> I would like to tell you what we have done till now...
>>>
>>> I am using couchbase lite on IOS and android along with sync gateway. 
>>> For authentication i use Nodejs api which is running on the *same host 
>>> as the sync gateway but on different port.*
>>> I call nodejs api when user taps login button which gets me a session 
>>> from gateway and i return the session cookie header in response from nodejs 
>>> to client. Now while setting up replication properties in app for sync i 
>>> explicitly define "header" object with "Cookie" property so that CBLite 
>>> recognizes the session and user while making calls to SG.
>>>
>>> I do the same in case of IOS app. The replication and syncing runs fine 
>>> on android but i am facing issues on IOS. The issue is that even if i 
>>> create a document with channel A and user A signed in on android, user B 
>>> with access to channel B using the app on IOS and logged in receives that 
>>> document which should not be the case. I have doubts if the session cookie 
>>> i generate is used by CBLite for making calls to Sg because the user on ios 
>>> is receiving all the documents regardless of any channel. 
>>>
>>> Any help is appreciated.
>>>
>>> -- 
>>> 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/4828e271-b45f-4e3a-8268-753b531675b1%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/mobile-couchbase/4828e271-b45f-4e3a-8268-753b531675b1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>
> my config json file
>
> {
>  "log": ["CRUD", "REST+"],
>  "databases": {
>  "budgetappdb": {
>  "server": "http://localhost:8091";,
>  "bucket": "sync_gateway",
>  "users": {
>  "GUEST": {"disabled" : false}
>  },
>  "sync":`function(doc,oldDoc){if (doc._deleted) 
> {requireUser(oldDoc.channels);return;}if(!doc.channels){throw({forbidden: 
> "Missing required 
> properties"});}if(oldDoc==null){requireUser(doc.channels)}else{requireUser(oldDoc.channels);}channel(doc.channels);access(doc.channels,doc.channels);}`
>  }
>  }
> }
>
>
> Replicate request header on IOS
>
> {"target":"budgetappdb","headers":{"Cookie":
> "SyncGatewaySession=238aa5d0b66d9588559756eb91c5427509a8c69a"},"source":{
> "url":"http://192.168.1.14:4984/budgetappdb","auth":{"name":"vinay"}},
> "continuous":true}
>
>
>
>
> Currently even though i login from IOS and Android with same credentials, 
> i do not get documents which i create on android on IOS but the reverse 
> works fine. Please ignore the original post regarding ios device receiving 
> all documents.Simply stating there is no pull at ios..just the push.
>
> i am posting a screenshot of sync gateway server logs 
>
>
> <https://lh5.googleusercontent.com/-GTbZK7iFnic/VIGocewCLXI/AAAAAAAAAhI/bdaRspfewro/s1600/Untitled.png>
>
>
>
>
>
>  
>

*OK UPDATE*

i disabled guest access from my config file and restarted SG. What happened 
was that on IOS the first time after installing the app and logging in i am 
able to successfully set the session cookie in cblite but once i close the 
app and restart it my requests to SG from CBLite throw "Login required" 
error.

That means my cookie isn't being set once i restart my app. This is despite 
the fact that i send session id manually in the replicate headers object. 
Why isn't SG authenticating the request despite of it containing a cookie 
in header ??

 

-- 
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-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/4b064ca7-706d-4479-9166-801e5c45b226%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to