Python ADAL 库的身份验证方法acquire_token_with_client_credentials不返回刷新令牌是否有原因?我想 Daemon 应用程序不需要在每次运行时都使用刷新令牌,但其他身份验证方法确实返回一个对我来说似乎很奇怪。
代码示例:
class AzureActiveDirectory_Helper:
_config = Configuration()
_resource = _config.Resource
_graph_api_endpoint = _config.Graph_API_Endpoint
_authority = _config.Authority
def __init__(self):
self.Context = adal.AuthenticationContext(self._authority)
self.Token = self.Context.acquire_token_with_client_credentials(
resource=self._resource,
client_id=self._config.Client_ID,
client_secret="thisIsASuperSecretKey!!"
)
self.Headers = {
'Authorization' : f'Bearer {self.Token["accessToken"]}',
'Accept' : 'application/json',
'Content-Type' : 'application/json'
}
self.Token 中的accessToken值确实有一个值,并且该令牌确实允许我针对 Azure AD 应用执行我需要的操作,但是使用刷新令牌而不是每次运行都获取新令牌不是最佳实践吗?
largeQ
相关分类