I’ve added a couple of questions surrounding the authentication element of Atlas Device Sync previously and everyone has been really helpful but for whatever reason, what I believe from my reading that I need to do has not actually worked and I’ve needed a lot of assistance to get things over the line.
I have a mobile app that I am wanting to develop. This mobile app will give me a JWT and I will use custom JWT authentication to authenticate into my Realm DB sync.
I have now enabled “custom user data” and mapped that to a UserId field in my Mongo document:
{
"_id": {
"$binary": {
"base64": "VngS3zFmSyK0K6emoxYXHg==",
"subType": "04"
}
},
"Organisations": [
{
"OrganisationId": 17,
"AppPermission": true
},
{
"OrganisationId": 18,
"AppPermission": false
},
{
"OrganisationId": 19,
"AppPermission": true
}
],
"Name": "Chris Boot",
"UserId": "567812df-3166-4b22-b42b-a7a6a316171e"
}```
However, I can never see this data and it always comes back as null.
My use case here is that based on who is logged in is what data gets downloaded to the device so if a user has access to organisation 17 and 19 in the app (which is aluded to in the demo snippet above) and the best way I see of doing this is using custom user data and then if that user has permissions revoked / added this will update the data on their device.
As ever, any assistance is very appreciated.