Role of email confirmation


#1

I am curious as to the role the email confirmation plays. As far as I can tell the user is still able to sync data to and from the realm platform, even if their email is not confirmed. Ideally I would like to make sure my user is actually verified before allowing them to use the application (similar to how email verifications typically work), but I don’t see any way to check for this in the Swift API. I see how the data shows up in Realm Studio, but having access to it via the API would be useful.

Since it does not appear that the email confirmation does much (expect maybe related to resetting passwords), I wanted to ask if this feature was one that was still being worked on or if it only had limited utility by design.

—Updated

I was able to figure out that the data I wanted is accessible as below:

user.retrieveInfo(forUser: userName, identityProvider: .usernamePassword, completion: { (userInfo, error) in
                        if let userInfo = userInfo {
                            debugPrint(userInfo.metadata)
                        }
                        
                        if let error = error {
                            debugPrint(error)
                        }
                    })

The returned userInfo.metatdata object contains if the user has been validated via email.
The important bit I was missing is that originally I was trying to pass the user.identity to the forUser parameter, but it needs to be the user name (in this case the email address) used when the user registered.


#2

This is super helpful!!

@Realm why don’t you put it in ReadMe or tutorials??

Extrelemy frustrating to waste 6hrs trying to figure this out!!


#3

I also figured out that if I create a record in realm right after Signing up (sync with register == true) - the access drops (or records are destroyed), so I can no longer access them from on behalf of SyncUser.current.configuration, like they were never created. This leaves a few options from Realm team to properly store user’s email address as SyncUser API doesn’t offer it, like :https://stackoverflow.com/questions/39929519/get-username-of-current-realm-syncuser-in-swift?rq=1 in UserDefaults. Once user’s email is confirmed - you can create a user in Realm and it shouldn’t disappear this time.

Realm team - clarify please if this way of thinking is fine?
As for seasoned developer this looks like a complete Kludge, inability to implement a proper way of authentication where user can disconnect concepts of auth user and user profile (misc. data) yet with ability to get the information about identity and here I mean email or username.

More over, it’s a mystery why cannot you implement a mechanism with deep/universal linking? So if user confirms his email he’s redirected to the app (expose a field for URL, provide instructions on how to create apple-app-site-association and how to generate a link.

Please get back on that matter (maybe I can contribute to this part)