图形API,无法通过 /ME /ChangePassword资源更改密码

发布于 2025-01-21 15:07:01 字数 1506 浏览 0 评论 0 原文

我正在尝试使用以下资源来更改用户密码:

用户以前是用邀请资源创建的:

访问令牌有权限:Directory.accessasuser.all。

代码如下:

graphClient().me()
                .changePassword(UserChangePasswordParameterSet
                        .newBuilder()
                        .withCurrentPassword(currentPassword)
                        .withNewPassword(newPassword)
                        .build())
                .buildRequest()
                .post()

我会收到错误:

"Incorrect password. Password provided does not match the 
old password. paramName: oldPassword, paramValue: , objectType: System.String"

直接由HTTP请求API时,我会遇到相同的错误。

我确定当前密码是正确的。

如果用户的密码程序fofile先前已更新,则更改密码有效:

https://learn.microsoft.com/en-us/graph/api /user-update?view = graph-rest-1.0& tabs = http#example-3-update-the-passwordprofile of-a-user-user-user-uset-to-reset-their-password

为什么用户可以' t接受邀请后更改密码?

I'm trying to change user's password with the following resource:

https://learn.microsoft.com/en-us/graph/api/user-changepassword?msclkid=9549af45bca611ecbef12e519c4fdf2c&view=graph-rest-1.0&tabs=http

The user is previously created with invitations resource:

https://learn.microsoft.com/en-us/graph/api/invitation-post?view=graph-rest-1.0&tabs=http

The access token has permission: Directory.AccessAsUser.All.

The code goes as follows:

graphClient().me()
                .changePassword(UserChangePasswordParameterSet
                        .newBuilder()
                        .withCurrentPassword(currentPassword)
                        .withNewPassword(newPassword)
                        .build())
                .buildRequest()
                .post()

I get the error:

"Incorrect password. Password provided does not match the 
old password. paramName: oldPassword, paramValue: , objectType: System.String"

I get the same error when requesting api directly by http.

I'm sure the current password is correct.

Changing password works if users's passwordProfile is previously updated with resource:

https://learn.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http#example-3-update-the-passwordprofile-of-a-user-to-reset-their-password

Why a user can't change password after accepting the invitation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文