Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将 JWT 与 RESTful 结合使用?
有用
@app.route('/test_route') @jwt_required() def protected(): return '%s' % current_identity
但是在这种情况下该怎么办?
api.add_resource(testApi, '/test_api')
我在 Flask-JWT 文档中找不到这种情况
你可以尝试这样的事情:
class TestApi(Resource): @jwt_required() def get(self): return '%s' % current_identity
稍后使用: api.add_resource(TestApi, '/test_api')