首页 > 解决方案 > 授予管理员同意 - 未考虑授予的同意

问题描述

我有一个 JavaScript 应用程序,使用 MSAL.js 1.3.0。系统提示我登录屏幕,我可以登录。但无论我如何在 Azure 门户中配置应用程序,我登录后总是收到以下消息:

在此处输入图像描述

因此,我授予了应用程序管理员同意:(几周前委派权限不需要。此外,下面的页面根本没有显示“需要管理员同意”)

在此处输入图像描述

但是,行为仍然没有改变。我无法通过“需要管理员批准”消息。

我的编码在这里:

    config: {
                msalConfig: {
                    auth: {
                        clientId: "b273e5a6-8940-481b-9c87-1b51310ff88c"
                    },
                    cache: {
                        cacheLocation: 'localStorage',
                        storeAuthStateInCookie: true
                    }
                },
                graphBaseEndpoint: "https://graph.microsoft.com/v1.0/",
                userInfoSuffix: "me/",
                queryMessagesSuffix: "me/messages?$search=\"$1\"&$top=150",
                scopeConfig: {
                    scopes: ['User.Read', 'Mail.Read']
                }
            },

            onInit: function () {
                this.oMsalClient = new Msal.UserAgentApplication(this.config.msalConfig);
                //check if the user is already signed in
                if (!this.oMsalClient.getAccount()) {
                    this.oMsalClient.loginPopup(this.config.scopeConfig).then(this.fetchUserInfo.bind(this));
                } else {
                    this.fetchUserInfo();
                }
            }

这是我的应用程序清单:

{
    "id": "HERE-WOULD-BE-AN-ID",
    "acceptMappedClaims": null,
    "accessTokenAcceptedVersion": 2,
    "addIns": [],
    "allowPublicClient": null,
    "appId": "b273e5a6-8940-481b-9c87-1b51310ff88c",
    "appRoles": [],
    "oauth2AllowUrlPathMatching": false,
    "createdDateTime": "2020-06-09T10:31:12Z",
    "groupMembershipClaims": null,
    "identifierUris": [],
    "informationalUrls": {
        "termsOfService": null,
        "support": null,
        "privacy": null,
        "marketing": null
    },
    "keyCredentials": [],
    "knownClientApplications": [],
    "logoUrl": null,
    "logoutUrl": null,
    "name": "2020-06-09 - Fiori Sandbox Test2",
    "oauth2AllowIdTokenImplicitFlow": true,
    "oauth2AllowImplicitFlow": true,
    "oauth2Permissions": [],
    "oauth2RequirePostResponse": false,
    "optionalClaims": null,
    "orgRestrictions": [],
    "parentalControlSettings": {
        "countriesBlockedForMinors": [],
        "legalAgeGroupRule": "Allow"
    },
    "passwordCredentials": [],
    "preAuthorizedApplications": [],
    "publisherDomain": "d063937domain.onmicrosoft.com",
    "replyUrlsWithType": [
        {
            "url": "https://d063937trial-d063937trialb-devspace-msgraph-ui.cfapps.eu10.hana.ondemand.com/ui/index.html",
            "type": "Web"
        }
    ],
    "requiredResourceAccess": [
        {
            "resourceAppId": "00000003-0000-0000-c000-000000000000",
            "resourceAccess": [
                {
                    "id": "570282fd-fa5c-430d-a7fd-fc8dc98a9dca",
                    "type": "Scope"
                },
                {
                    "id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
                    "type": "Scope"
                }
            ]
        }
    ],
    "samlMetadataUrl": null,
    "signInUrl": null,
    "signInAudience": "AzureADandPersonalMicrosoftAccount",
    "tags": [],
    "tokenEncryptionKeyId": null,
    "verifiedPublisher": {
        "displayName": null,
        "verifiedPublisherId": null,
        "addedDateTime": null
    }
}

PS:我不是 JavaScript 开发人员,只是从同事那里拿了一个最近工作的应用程序并想使用它。如果有什么遗漏,请告诉我。

干杯,马克斯

标签: azure-active-directorymicrosoft-graph-apiazure-ad-graph-apimsalmsal.js

解决方案


如果您希望最终用户可以同意应用代表他们访问公司数据,您需要使用管理员帐户登录 Azure 门户以启用此功能。

转到Azure Active Directory ->企业应用程序->用户设置,为“用户可以同意应用代表他们访问公司数据”选择是。

在此处输入图像描述

如果您希望最终用户可以请求访问需要管理员同意的应用程序,您可以配置管理员同意工作流


推荐阅读