diff --git a/example-config.yaml b/example-config.yaml
index 61b833e2a72be520f3a1c8c0c6a922fd062f889e..72dd3882d5308e43c81f24564e8b15e719273782 100644
--- a/example-config.yaml
+++ b/example-config.yaml
@@ -82,6 +82,12 @@ bridge:
     # Whether or not to use /sync to get presence, read receipts and typing notifications when using
     # your own Matrix account as the Matrix puppet for your Facebook account.
     sync_with_custom_puppets: true
+    # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
+    #
+    # If set, custom puppets will be enabled automatically for local users
+    # instead of users having to find an access token and run `login-matrix`
+    # manually.
+    login_shared_secret: null
     # Whether or not to bridge presence in both directions. Facebook allows users not to broadcast
     # presence, but then it won't send other users' presence to the client.
     presence: true
diff --git a/mautrix_facebook/config.py b/mautrix_facebook/config.py
index b2c2b7e9313303f47fd718014a758f8e3679048f..6d340ed873224f5f479927001e849fdef1f9b4bf 100644
--- a/mautrix_facebook/config.py
+++ b/mautrix_facebook/config.py
@@ -36,6 +36,7 @@ class Config(BaseBridgeConfig):
         copy("bridge.initial_chat_sync")
         copy("bridge.invite_own_puppet_to_pm")
         copy("bridge.sync_with_custom_puppets")
+        copy("bridge.login_shared_secret")
         copy("bridge.presence")
         copy("bridge.update_avatar_initial_sync")
 
diff --git a/mautrix_facebook/puppet.py b/mautrix_facebook/puppet.py
index f8966807f1bc4620bfa9baef02221bfba15f7bea..2db002e15575e961a8f22389e4d4ed4caabf64fd 100644
--- a/mautrix_facebook/puppet.py
+++ b/mautrix_facebook/puppet.py
@@ -260,4 +260,7 @@ def init(context: 'Context') -> Iterable[Awaitable[None]]:
     Puppet.mxid_template = SimpleTemplate(config["bridge.username_template"], "userid",
                                           prefix="@", suffix=f":{Puppet.hs_domain}", type=str)
 
+    Puppet.login_shared_secret = config["bridge.login_shared_secret"].encode("utf-8")
+    Puppet.login_device_name = "Facebook Messenger Bridge"
+
     return (puppet.try_start() for puppet in Puppet.get_all_with_custom_mxid())
diff --git a/mautrix_facebook/user.py b/mautrix_facebook/user.py
index 6788cd226de3a11b80d32c7b2549c7e992147907..498d5481883e123a21a213645801b31b957f6084 100644
--- a/mautrix_facebook/user.py
+++ b/mautrix_facebook/user.py
@@ -168,6 +168,16 @@ class User(Client):
     async def post_login(self) -> None:
         self.log.info("Running post-login actions")
         self.by_fbid[self.fbid] = self
+
+        try:
+            puppet = pu.Puppet.get_by_fbid(self.fbid)
+
+            if puppet.custom_mxid != self.mxid and puppet.can_auto_login(self.mxid):
+                self.log.info(f"Automatically enabling custom puppet")
+                await puppet.switch_mxid(access_token="auto", mxid=self.mxid)
+        except Exception:
+            self.log.exception("Failed to automatically enable custom puppet")
+
         await self._create_community()
         await self.sync_contacts()
         await self.sync_threads()
diff --git a/setup.py b/setup.py
index ba8c9f877bf9b58a29740ef30f5d2411063ffbfb..2b1f2579c9aa51a4717d8d46ebe9f5cd80618e3a 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,7 @@ setuptools.setup(
 
     install_requires=[
         "aiohttp>=3.0.1,<4",
-        "mautrix>=0.4.0rc2,<0.5.0",
+        "mautrix>=0.4.0rc4,<0.5.0",
         "ruamel.yaml>=0.15.94,<0.17",
         "commonmark>=0.8,<0.10",
         "python-magic>=0.4,<0.5",