随着Google对OpenID 2的支持即将关闭,任何使用Flask-Googleauth等便捷库的人都必须迁移.有一个用于OpenID Connect的Flask库,名为flask-oidc.不幸的是,似乎没有关于如何使用它的任何信息.我找了标记的做题flask和openid-connect,却发现零,因此这个问题.
以下是我作为flask-oidc概念验证使用的内容.它基于flask-oidc的app.py文件:
"""
Flask app for testing the OpenID Connect extension.
"""
from flask import Flask
from flask.ext.oidc import OpenIDConnect
def index():
return "too many secrets", 200, {
'Content-Type': 'text/plain; charset=utf-8'
}
def create_app(config, oidc_overrides=None):
app = Flask(__name__)
app.config.update(config)
if oidc_overrides is None:
oidc_overrides = {}
oidc = OpenIDConnect(app, **oidc_overrides)
app.route('/')(oidc.check(index))
return app
if __name__ == '__main__':
APP = create_app({
'OIDC_CLIENT_SECRETS': './client_secrets.json',
'SECRET_KEY': 'secret'})
APP.run(host="127.0.0.1", port=8080, debug=True)
Run Code Online (Sandbox Code Playgroud)
按照 …
如果我pip install cffi,我会得到这个:
building '_cffi_backend' extension
c:\mingw\bin\gcc.exe -mdll -O -Wall -Ic/libffi_msvc -IC:\python27\include -IC:\python27\PC -c c/_cffi_backend.c -o build\temp.win32-2.7\Release\c\_cffi_backend.o
...
(lots of warnings)
...
c/libffi_msvc\win32.c: In function 'ffi_call_x86':
c/libffi_msvc\win32.c:48:2: error: '_asm' undeclared (first use in this function)
c/libffi_msvc\win32.c:48:2: note: each undeclared identifier is reported only once for each function it appears in
c/libffi_msvc\win32.c:48:7: error: expected ';' before '{' token
c/libffi_msvc\win32.c:162:1: warning: control reaches end of non-void function [-Wreturn-type]
error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
这显然是在使用 MinGW。
我还尝试在这里从轮子安装: …