GraphServiceClient token cache persistence and CAE control
Maintainer thường phản hồi trong vòng 1 ngày
@ramsessanchez đang làm issue này rồi.
Từ ngày 18/5/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 634
- Fork
- 100
- Merge trung bình
- 23 giờ 18 phút
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoftgraph/msgraph-sdk-python
-
status:waiting-for-triage type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
microsoftgraph/msgraph-sdk-python#1628 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:waiting-for-triage type:bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:waiting-for-triage type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoftgraph/msgraph-sdk-python#1563 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kiota-dom-export.txt is large and included in the released packageCó thể đã có người làm @Fryguy đã nhận 185 ngày trước. Đang mởNeeds: Attention :wave: type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
microsoftgraph/msgraph-sdk-python#1287 · 3 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:waiting-for-triage type:feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
microsoftgraph/msgraph-sdk-python#1596 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoftgraph/msgraph-sdk-python
Issue tương tự
-
tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Plugin] 群聊记忆 · 人格养成Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 74/100
-
bug maintainer-managed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
awslabs/visual-asset-management-system#1759 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100