问题描述
我要在Web应用程序中添加一个SSO按钮。
I am going to add a SSO button to my web appication.
我要使用 python-social-auth
。但是受支持的Web框架是Django,Flask,Pyramid,Tornado,CherryPy和webpy。似乎不支持Bottle框架。
I want to use python-social-auth
for it. But the supported web frameworks are Django, Flask, Pyramid, Tornado, CherryPy and webpy. It seems to not support Bottle framework.
如何为我的Bottle应用程序使用 python-social-auth
?
How to use python-social-auth
for my Bottle app?
我应该创建自己的 social-auth-app-bottle
吗?
- 如果不是那么简单的工作,哪个更好:
- If it is not so simple work, which one is better:
- 移动到烧瓶
- 不要使用
python-social-auth
(并移至其他Bottle插件,例如bottle-rauth
,bottle-oauthlib
等)
- Move to Flask
- Don't use
python-social-auth
(and move to other Bottle plugins likebottle-rauth
,bottle-oauthlib
, etc)
推荐答案
我将Google的firebase用于所有内容。它具有简单的javascript元素,可将对象有效载荷提供给您的后端。我将瓶
用于一切。老实说,我发现firebase资料是管理您的登录信息的最简单,最可靠的方法。
I use firebase from Google for everything. It has simple javascript elements that feed an object payload to your backend. I use bottle
for EVERYTHING. And honestly I found the firebase stuff the easiest and most robust way to manage your logins.
import firebase_admin
from firebase_admin import credentials, auth as firebase_auth
cred = credentials.Certificate("<yours>-adminsdk-AAAAA-1234567.json")
firebase_admin.initialize_app(cred)
def checkToken(token):
try:
return firebase_auth.verify_id_token(token)
except:
return False
def login(payload):
user = checkToken(payload['token']) or redirect('/logout')
# <your code here>
这篇关于我可以在我的Bottle应用中使用python-social-auth吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!