Reputation: 621
I have some python rest API that i would like to protect with azure AD. To do so I was thinking to validate the bearer token for each request according to the example: https://github.com/Azure-Samples/ms-identity-python-webapi-azurefunctions.
Is that the correct approach? What is the best practice? 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)?
Thank you Riccardo
Upvotes: 2
Views: 2523
Reputation: 42163
Is that the correct approach? What is the best practice?
Yes, it is correct, and it should be the best pratice(at least I can find). To protect the APIs with Azure AD, you always need to register an AD App for it, expose the APIs, then in your client app, add the API permission, the user login and consent the permission, get the token and call the 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)?
As far as I know, there is no such thing similar to flask-login for APIs.
Upvotes: 3