Register users with passwords in my app


#1

Hi,

I have my own app. I’ve implemented Realm Cloud on it and apparently, all works fine.

I just have one issue. I register users with low-security method (as Admin, no password), following the ToDo example app:

let creds = SyncCredentials.nickname(nick, isAdmin: true)

It works and I want to register users with password now:

let credential = SyncCredentials.usernamePassword(username: nick, password: password, register: true)

the login method returns a user object and no errors. The method SyncUser.current return a valid SyncUser

However, I check my Realm Studio and the PATH - OWNER doesn’t exist.

I read in the docs:

Realm supports a number of authentication methods:  For prototyping (or low-security applications) the Nickname method - which allows you to log in without needing a password […]

[…]We will revisit this later, but for the purposes of getting started quickly we recommend that you keep this to true to encounter less friction when learning more about Realm.

I’ve been looking for more info about it but I couldn’t find anything. What I make wrong?

Thank you guys


#2

However, I check my Realm Studio and the PATH - OWNER doesn’t exist.

What do you mean by this?

The nickname and username/password are separate authentication mechanisms so if you use a nickname: afish but then use username/password with a username: afish this should appear as two users in the system and not merge into one.


#4

Hi,

If I use nickname mechanism, I see PATH-OWNER in Realm Studio (https://cl.ly/2v310B0n3P3j5). I can write objects and then read them.

However, if I try to register a new user with username/password (anamsp80…), the account is registered (https://cl.ly/2d002T2M0x2i3) but it doesn’t have a PATH (https://cl.ly/3W2O1u2i0M0g3) The objects aren’t stored in the system and I can’t read them later.

Maybe I’m understanding something wrong about the auth mechanisms and its consequences in the system. I guess every user should have their path associated and their object should be stored there. Is it correct?