wanyuwei hi. The recommended solution for "single sign on" or "federated login" is to configure your main app as an OAuth server, using a package like Laravel Passport. You can then configure your Flarum as an OAuth client, which can be done using the FoF Passport extension or by building your own extension inspired by the existing social login extensions.
To implement global login from a second app, it's possible to create a Flarum remember cookie with a token created from Flarum's REST API which will connect the user once they visit Flarum.
One example of a global login integration is the Wordpress SSO extension. My own premium Wordpress extension also features an advanced login/logout integration but the code isn't open-source.