Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-842

Refactor the Authentication Patterns in Realm JS

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • JS-v11.0.0, JS-v12.0.0
    • Affects Version/s: None
    • Component/s: None

      Authentication in Realm is wrapped in nested namespaces, which makes the process not entirely straightforward. I believe we should rethink the way authentication is done and come up with a more ergonomic interface.

      For example:
      ```jsx
      // login
      const creds = Realm.Credentials.emailPassword(email, password);
      await app.logIn(creds);

      // register
      await app.emailPasswordAuth.registerUser(

      {email, password}

      );
      ```

      In most cases, all required parameters for authentication are nested. Perhaps something like:
      ```jsx
      import

      {emailPassword}

      from '@realm/auth'

      emailPassword.login()
      emailPassword.register()

      ```

            Assignee:
            Unassigned Unassigned
            Reporter:
            kenneth.geisshirt@mongodb.com Kenneth Geisshirt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: