小编Fei*_*SFT的帖子

如何使用Azure AD验证VueJS应用程序?

我正在使用VueJS 2.x框架设置应用程序,它需要通过Azure Active Directory服务对用户进行身份验证.我已经拥有该服务的"登录信息"(Auth和令牌URL).

到目前为止,我只遇到过一篇文章,显示了VueJS中的设置,但它依赖于第三方服务(Auth0) - 在此过程中添加了不必要的卷积.

没有任何VueJS npm模块允许轻松进行身份验证时,如何继续?或者您是否必须依赖Vue之外的图书馆,如Adal JS

任何的意见都将会有帮助.

azure node.js azure-active-directory vue.js vuejs2

14
推荐指数
3
解决办法
9043
查看次数

如何在 MVC 应用程序中使用 Microsoft Graph 访问其他用户的资源(特别是电子邮件)?

我似乎在为我的应用程序授予访问组织电子邮件中的另一个用户所需的权限时遇到问题。我让我的管理员通过 Azure 门户授予我的应用程序所有可能的权限,并且我在从 Graph 网站下载的测试应用程序中收到“访问被拒绝”错误。这让我觉得我可能没有使用正确的 API 调用。

这是我用来检索另一个用户的电子邮件的代码:

IMailFolderMessagesCollectionPage messages = await graphClient.Users["userID"].MailFolders.Inbox.Messages.Request().Top(25).GetAsync();
Run Code Online (Sandbox Code Playgroud)

其中“userID”是我通过图形浏览器获取组织中所有用户获得的 id 值。

完整代码:

(控制器)

[Authorize]
public async Task<ActionResult> GetEmails()
        {
        try
        {
            // Initialize the GraphServiceClient.
            GraphServiceClient graphClient = SDKHelper.GetAuthenticatedClient();

            ResultsViewModel results = new ResultsViewModel();
            // Get the messages. 
            results.Items = await graphService.GetMyInboxMessages(graphClient);
            return View("Graph", results);
        }
        catch (ServiceException se)
        {
            if (se.Error.Code == Resource.Error_AuthChallengeNeeded) return new EmptyResult();
            return RedirectToAction("Index", "Error", new { message = Resource.Error_Message + Request.RawUrl + ": " + se.Error.Message });
        }
    } …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc azure azure-active-directory microsoft-graph-api

2
推荐指数
1
解决办法
2078
查看次数