GraphServiceClient token cache persistence and CAE control
メンテナーはふだん 1 日以内に返信
@ramsessanchez がすでに取り組んでいます。
2026年5月18日 から。
評価
この issue はまだ評価されていません。
説明
Is your feature request related to a problem? Please describe the problem.
As outlined in this issue: https://github.com/Azure/azure-sdk-for-python/issues/42898
Given this example code:
token_cache_options = TokenCachePersistenceOptions(name="MyApp")
if Path("cred.json").exists():
with open("cred.json", "r") as f:
deserealized_record = AuthenticationRecord.deserialize(f.read())
device_credential = DeviceCodeCredential(
client_id=azure_settings["clientId"],
tenant_id=azure_settings["tenantId"],
authentication_record=deserealized_record,
cache_persistence_options=token_cache_options,
disable_automatic_authentication=True,
)
else:
device_credential = DeviceCodeCredential(
client_id=azure_settings["clientId"],
tenant_id=azure_settings["tenantId"],
cache_persistence_options=token_cache_options,
disable_automatic_authentication=True,
)
record = device_credential.authenticate(scopes=azure_settings["graphScope"])
with open("cred.json", "w") as f:
f.write(record.serialize())
app_client = GraphServiceClient(
credentials=device_credential, scopes=azure_settings["graphScope"]
)
# do something with app_client, eg: `app_client.me.get()`
We will not be able to achieve token cache persistence, because by default, the AzureIdentityAuthenticationProvider used internally by the GraphServiceClient has it's CAE setting set to True while the DeviceCodeCredential.authenticate method defaults it to False. Setting the value in authenticate explicitly to True makes the code work:
record = device_credential.authenticate(scopes=azure_settings["graphScope"], enable_cae=True)
But this leaves one issue - if (for some reason) someone wants to set the above value to False, they will never be able to make the code work using the current implementation of the GraphServiceClient.
Describe the solution you'd like.
It is my suggestion to add an argument to the GraphServiceClient initializer method to allow controlling the is_cae_enabled parameter of the AzureIdentityAuthenticationProvider object created inside.
Additional context?
No response
- 主要言語
- Python
- スター
- 634
- フォーク
- 100
- 平均マージ
- 23時間 18分
- マージ済み PR(30日)
- 7
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoftgraph/msgraph-sdk-python のほかの issue
-
status:waiting-for-triage type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
microsoftgraph/msgraph-sdk-python#1628 ·
メンテナーはふだん 1 日以内に返信
-
status:waiting-for-triage type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
メンテナーはふだん 1 日以内に返信
-
status:waiting-for-triage type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoftgraph/msgraph-sdk-python#1563 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
kiota-dom-export.txt is large and included in the released package対応中かも @Fryguy が 185 日前に担当しました。 オープンNeeds: Attention :wave: type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoftgraph/msgraph-sdk-python#1287 · コメント 3 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
status:waiting-for-triage type:feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
microsoftgraph/msgraph-sdk-python#1596 ·
メンテナーはふだん 1 日以内に返信
microsoftgraph/msgraph-sdk-python の issue をすべて見る
似ている issue
-
tests
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[Plugin] 群聊记忆 · 人格养成オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 74/100
-
bug maintainer-managed
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
awslabs/visual-asset-management-system#1759 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100