第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Python ADALacquire_token_with_client_ 刷新令牌?

Python ADALacquire_token_with_client_ 刷新令牌?

慕妹3242003 2021-11-30 16:59:27
Python ADAL 庫的身份驗(yàn)證方法acquire_token_with_client_credentials不返回刷新令牌是否有原因?我想 Daemon 應(yīng)用程序不需要在每次運(yùn)行時(shí)都使用刷新令牌,但其他身份驗(yàn)證方法確實(shí)返回一個(gè)對(duì)我來說似乎很奇怪。代碼示例:class AzureActiveDirectory_Helper:_config = Configuration()_resource = _config.Resource_graph_api_endpoint = _config.Graph_API_Endpoint_authority = _config.Authoritydef __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值確實(shí)有一個(gè)值,并且該令牌確實(shí)允許我針對(duì) Azure AD 應(yīng)用執(zhí)行我需要的操作,但是使用刷新令牌而不是每次運(yùn)行都獲取新令牌不是最佳實(shí)踐嗎?
查看完整描述

1 回答

?
largeQ

TA貢獻(xiàn)2039條經(jīng)驗(yàn) 獲得超8個(gè)贊

是的,我同意使用刷新令牌而不是每次都獲取新的新令牌是最佳做法。

使用客戶端憑據(jù)授予發(fā)布刷新令牌沒有任何好處。這就是為什么RFC6749 第 4.4.3 節(jié)指出不應(yīng)包含刷新令牌的原因。

根據(jù)文檔,“acquire_token_with_client_credentials”僅返回訪問令牌。

因此要使用刷新令牌,python adal 庫支持其他身份驗(yàn)證方法,例如:“acquire_token”、“acquire_token_with_refresh_token”等。您可以查看文檔。

以下是文檔鏈接:

https://docs.microsoft.com/en-us/python/api/adal/adal.authentication_context.authenticationcontext?view=azure-python#acquire-token-with-client-credentials-resource--client-id--客戶秘密-

https://adal-python.readthedocs.io/en/latest/


查看完整回答
反對(duì) 回復(fù) 2021-11-30
  • 1 回答
  • 0 關(guān)注
  • 312 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)