[英]How do we validate the access token from azure AD in backend?
I have a accesToken from azure AD.我有一个来自 azure AD 的 accesToken。 I need to validate them in python.我需要在 python 中验证它们。 How can I do that?我怎样才能做到这一点?
One of the workaround is to use PyJWT and cryptography dependancies (Because it contains binary dependencies, it must be created and packaged for the target operating system) to support the RS256 algorithm.一种解决方法是使用 PyJWT 和加密依赖项(因为它包含二进制依赖项,所以必须为目标操作系统创建和打包)来支持 RS256 算法。
pip install pyjwt cryptography requests
Then use the App ID to validate the token.然后使用 App ID 验证令牌。
import jwt
app_id = 'd31a4d20-6c4a-1a40-b74d-1a3d461bb3d8'
access_token = 'XXXX'
token_header = jwt.get_unverified_header(access_token)
For more information you can refer有关更多信息,您可以参考
REFERENCES:参考:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.