1
Flask-RESTfulアプリケーションにAutho0を使用する必要があります。 Auth0にはexampleがあり、ビュー機能にrequires_auth
デコレータを使用しています。フラスコのRESTfulでFlask-RESTfulリソースでAutho0デコレータを使用する
@app.route('/secured/ping')
@cross_origin(headers=['Content-Type', 'Authorization'])
@requires_auth
def securedPing():
return "All good. You only get this message if you're authenticated"
私はビュー機能をResource
クラス、ないapp.route
でadd_resource
を使用しています。 requires_auth
をVersion
に適用するにはどうすればよいですか?
app = Flask(__name__)
API = Api(app)
CORS = CORS(app, resources={r'/api/*': {'origins': '*'}})
API.add_resource(Version, '/api/v1')