It seems like you want something like OAuth instead of using Flask-Login. If you do not know (quoted on Wikipedia), OAuth is a protocol that uses tokens to access resources on behalf of the owner of the resource. Consider giving the user the ability to issue a valet key to certain parts of your site. Many sites, such as Google, Facebook, and Twitter, use OAuth to authenticate third-party clients to access certain user resources.
There is currently a separation between the less flexible and less complex OAuth 1.0a and the more flexible but more complex OAuth 2.0. There are many libraries for OAuth 1.0a in Python, but less for OAuth 2.0. However, there is a choice for OAuth 2.0 if stability is not a major concern right now.
Flask-OAuth is available to the client if you are building with OAuth 1.0a and it is supported by Armin, the creator of Flask, so you can be sure that he will not die. There is an extension for the provider called Flask-OAuthProvider with support for OAuth 1.0a. If you don't mind integrating it yourself and want to support 2.0, pyoauth2 provides you with both a client and a provider, although it seems less maintenance.
Hope this helps you learn one of the possible ways to use auth tokens, albeit without using Flask-Login. In my opinion, you should not reinstall the protocol if they do not understand it, so I recommend reading about OAuth, even if you decide not to use it. There are many great articles on it, such as this article from Google and.
Smartboy
source share