使用azure AD保护python rest API

2024-05-19 23:02:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一些我想用azure AD保护的python rest API。 为此,我考虑根据以下示例验证每个请求的承载令牌: https://github.com/Azure-Samples/ms-identity-python-webapi-azurefunctions

这是正确的方法吗?最佳做法是什么? 管理会话没有更简单的方法吗?类似于flask登录的东西,但用于API(即不基于会话cookie的东西)

多谢各位 里卡多


Tags: 方法httpsgithubcomrestapi示例azure
1条回答
网友
1楼 · 发布于 2024-05-19 23:02:49

Is that the correct approach? What is the best practice?

是的,这是正确的,这应该是最好的做法(至少我能找到)。要使用Azure AD保护API,您始终需要为其注册广告应用程序,公开API,然后在客户端应用程序中添加API权限,用户登录并同意该权限,获取令牌并调用API

There is not a simpler way to managing sessions? Something similar to flask-login but for APIs (i.e. something not based on session cookies)?

据我所知,没有类似于flask登录API的东西

相关问题 更多 >