microsoftgraph / microsoftgraph/msgraph-sdk-java
Authenticating using ConfidentialClient
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 444
- Fork
- 154
- Merge trung bình
- 18 giờ 28 phút
- Pull request đã merge (30 ngày)
- 4
Mô tả
Hello,
Some of our customers are unable to send out automated emails because support for basic authentication with SMTP is being removed.
I am looking at finding a solution and it seems the Graph API is the recommended approach.
I have manage to create a working example using PublicClientApplicationBuilder however, this class displays a pop-up requiring the user to sign in, since we have automated services with no user interaction, this is not a good solution.
I have seen some examples using ConfidentialClientApplicationBuilder and this seems idea.
However, I have reached multiple dead-ends and everytime receive the error:
Confidential Client flows are not available on mobile platforms or on Mac.See https://aka.ms/msal-net-confidential-availability for details.
I understand that it is limeted by design (see issues/742) but ConfidentialClientApplicationBuilder throws this issue for every project type I try, WinForm, Windows Service, Console app.
I have got it working on a ASP controller but they is not practicable for our customer.
I am storing my Client, Tenant and Secret in a database table and here is my code:
Private Async Function GetAppAuthentication() As Task(Of AuthenticationResult)
Dim folderAccess = BLL.L2S.SystemApplicationGateway.GetFolderAccess(mBLL_SY.ReadonlyDbContext)
If folderAccess Is Nothing Then
Return Nothing
End If
Dim app = ConfidentialClientApplicationBuilder.Create(folderAccess.Client) _
.WithClientSecret(folderAccess.Secret) _
.WithTenantId(folderAccess.Tenant) _
.Build()
Dim scopes As String() = {"https://outlook.office365.com/.default"}
Dim result As AuthenticationResult = Await app.AcquireTokenForClient(scopes).ExecuteAsync()
Return result
End Function
I am using .Net Framework 4.7.2, we have Windows Services and WinForms apps and both need to send out emails.
The error message is very confusing to me because of course it is not a mobile app, and I have even created a UnitTest that seemingly works fine which again is very confusing to me.
This is urgent as this is already causing issues for our customers.
Thanks in advance.
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.
Hướng nghiên cứu
Trước tiên, hãy kiểm tra xem câu hỏi xác thực .NET này có thuộc repository msgraph-sdk-java hay không, sau đó xem lại hàm GetAppAuthentication được báo cáo và liên kết về tính khả dụng của ConfidentialClientApplicationBuilder. Hoàn thành nghĩa là xác định lý do các kịch bản Windows Service và WinForms nhận được lỗi này, đồng thời ghi lại hoặc xác nhận một cách tiếp cận được hỗ trợ; không có tệp dự án hoặc bài kiểm thử nào được nêu tên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Lĩnh vực
- authentication
- Loại issue
- Lỗi
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 15/100