错误“ AADSTS50076”在使用户访问令牌的同时

发布于 2025-02-12 23:43:08 字数 692 浏览 0 评论 0原文

我正在尝试使用户访问令牌从node.js代码访问图形API。

My Request: 
POST https://login.microsoftonline.com/<AD-Tenant-Id>/oauth2/v2.0/token

client_id: <application ID>
client_secret: <secret string>
scope: User.Read
response_type: "code"
grant_type: "password"
username: <user email>
password: <user password>
I get error: 
AADSTS50076: Due to a configuration change made by your administrator,
or because you moved to a new location, you must use multi-factor authentication to access....

我正在使用Postman测试请求。
在我的广告中,我有多因素身份验证。
和“安全默认值”设置为“启用”。
如果我“禁用”“安全默认值”,那么我就能获得令牌。

有没有办法可以在没有用户交互的情况下启用“安全默认值”并获得令牌?

I am trying to get the user access token for accessing Graph APIs from the node.js code.

My Request: 
POST https://login.microsoftonline.com/<AD-Tenant-Id>/oauth2/v2.0/token

client_id: <application ID>
client_secret: <secret string>
scope: User.Read
response_type: "code"
grant_type: "password"
username: <user email>
password: <user password>
I get error: 
AADSTS50076: Due to a configuration change made by your administrator,
or because you moved to a new location, you must use multi-factor authentication to access....

I am using postman for testing the request.
In my AD I have multi-factor authentication disabled.
And "Security Defaults" are set to "enable".
If I "disable" the "Security Defaults", then I am able to get the token.

Is there a way I can keep the "Security Defaults" enabled and get the token, without the user interaction?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失退 2025-02-19 23:43:08

您可以尝试代表用户获取访问权限,ref doc- https://learn.microsoft.com/en-us/graph/auth-v2-user#3-get-a-token

noreferrer /1.1
主机: https://login.microsoftonline.com
content-type:应用程序/x-www-form-urlencoded

client_id =1111111111-1111-1111-1111-1111111111111111111111111111111111111111111111111111111111

&code=OAAABAAAAiL9Kn2Z27UubvWFPbm0gLWQJVzCTE9UkP3pSx1aXxUjq3n8b2JRLk4OxVXr...

&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F

&grant_type=authorization_code

&amp; client_secret = jxom3iz ...

希望这会有所帮助。

You can try out Get access on behalf of a user , ref doc - https://learn.microsoft.com/en-us/graph/auth-v2-user#3-get-a-token

POST /{tenant}/oauth2/v2.0/token HTTP/1.1
Host: https://login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

client_id=11111111-1111-1111-1111-111111111111

&scope=user.read%20mail.read

&code=OAAABAAAAiL9Kn2Z27UubvWFPbm0gLWQJVzCTE9UkP3pSx1aXxUjq3n8b2JRLk4OxVXr...

&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F

&grant_type=authorization_code

&client_secret=jXoM3iz...

Hope this will help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文