英文:
IAuthenticationProvider is deprecated in microsoft-graph:2.3.0, how do I create a GraphServiceClient instance now?
问题
我正在升级我项目中的 msgraph-sdk-java 库的版本。之前我使用的是版本 1.7.1,但在上传大于 4MB 的文件时遇到了一些设置冲突行为的问题。我看到这个问题在最新版本中得到了修复(见此处),因此我正尝试升级到版本 2.3.0。
我更新了我的 build.gradle 文件,注意到现在 IAuthenticationProvider 接口已被弃用。
> 在 HTTP 提供程序发送请求之前为其提供身份验证。
>
> @deprecated 使用 ICoreAuthenticationProvider 替代
它说我应该使用 ICoreAuthenticationProvider,但如果我不实现 IAuthenticationProvider 接口,如何构建一个新的 GraphServiceClient 实例呢?
this.graphClient = GraphServiceClient.builder()
.authenticationProvider(appAuthProvider)
.buildClient();
另外,在库的 README 中,它说我们应该使用 IAuthenticationProvider,这更加令人困惑:
英文:
I am upgrading the version of the msgraph-sdk-java library in my project. I was using version 1.7.1 but I had some issues with setting conflict behavior when uploading files >4MB. I saw the issue was fixed in the latest version (see here) so I am trying to upgrade to version 2.3.0.
I updated my build.gradle file and noticed that now the interface IAuthenticationProvider is deprecated.
> Provides authentication for a requests before it is sent by an HTTP
> provider.
>
> @deprecated use ICoreAuthenticationProvider instead
It says I should use ICoreAuthenticationProvider instead but how do I build a new instance of GraphServiceClient without implementing the IAuthenticationProvider interface?
this.graphClient = GraphServiceClient.builder()
.authenticationProvider(appAuthProvider)
.buildClient();
Also, in the README of the library, it says we SHOULD use IAuthenticationProvider, which is even more confusing:
答案1
得分: 1
只需使用您本应使用的任何实现。
虽然它已被弃用,但目前仍然有效。
我想更新将允许在GraphServiceClient构造函数中使用ICoreAuthenticationProvider,但目前尚未出现。
英文:
Just use whatever implementation you would have.
Whilst it is deprecated, it still works for now.
I imagine an update will allow the ICoreAuthenticationProvider to be used in the GraphServiceClient constructor, but that's not present yet.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论