我想在这里使用 microsoft task api https://docs.microsoft.com/zh-cn/previous-versions/office/office-365-api/api/version-2.0/task-rest-operations。我明白如果我想请求 api 我应该使用 OAuth2。这是我的 OAuth 步骤:
第 1 步:在 azure 中注册应用程序并配置重定向 uri,然后我可以获得 client_id 和新的客户端密钥。

第 2 步:获取https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=<client_id>&redirect_uri=http://localhost:8080&response_type=code&scope=Tasks.Read。现在我可以从重定向 uri 参数中获取代码:http://localhost:8080/?code=Mfcae1736-738e-3aff-2de6-7a6d72308feb#/login
第 3 步:https://login.microsoftonline.com/common/oauth2/v2.0/token使用参数POST ,如下所示:

第 4 步:从第 3 步我可以获得 access_token,(但它不是 jwt 令牌,为什么?),所以我可以通过 access_token 获取任务。

现在出现问题,请求返回错误,但我不知道为什么,也不知道在哪里可以找到正确的文档以及如何修复它。
{"error":{"code":"InvalidMsaTicket","message":"ErrorCode: 'PP_E_RPS_CERT_NOT_FOUND'. Message: ' Internal error:
spRPSTicket->ProcessToken failed. Failed to call CRPSDataCryptImpl::UnpackData: Internal error: Failed to decrypt data.
:Failed to get session key. RecipientId=293577. spCache->GetCacheItem returns error.:Cert Name: (null). SKI:
3bd72187c709b1c40b994f8b496a5b9ebd2f9b0c...'","innerError":{"requestId":"c6cec9b3-091f-439d-8e01-5489eef2b776","date":"2019-09-24T03:27:02"}}}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个 macos 软件,我发现在 swiftui 中,滚动视图设置为.horizontal,因此当鼠标滚轮滚动时列表不会滚动,但在.vertical模式下会滚动。
但我确实需要这个功能。
所以我尝试了一种选择:实现一个可以处理鼠标滚轮滚动事件的NSViewRepresentableNSView 重写方法。scrollWheel然后发布通知。
struct MouseWheelScrollEventView : NSViewRepresentable {
class MouseView : NSView {
override var acceptsFirstResponder: Bool {
true
}
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
return true
}
override func scrollWheel(with event: NSEvent) {
NotificationCenter.default.post(name: Notification.Name("mouseevent"), object: event)
}
}
func makeNSView(context: Context) -> some NSView {
let view = MouseView()
DispatchQueue.main.async {
view.window?.makeFirstResponder(view)
}
return view
}
func updateNSView(_ nsView: NSViewType, context: Context) …Run Code Online (Sandbox Code Playgroud)