我正在尝试从node.js代码中获取用于访问Graph的用户访问令牌。
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....我正在用邮递员来测试这个请求。
在我的AD中,我禁用了多因素身份验证。
“安全默认值”设置为“启用”。
如果我“禁用”“安全默认值”,那么我就能够获得令牌。
是否有一种方法可以使“安全默认值”启用并获得令牌,而无需用户交互?
发布于 2022-07-05 18:09:48
您可以代表用户ref - doc - https://learn.microsoft.com/en-us/graph/auth-v2-user#3-get-a-token尝试Get访问。
POST /{tenant}/oauth2/v2.0/token HTTP/1.1主机:https://login.microsoftonline.com内容-类型: 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...
希望这能帮上忙。
https://stackoverflow.com/questions/72865349
复制相似问题