首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的应用程序中的office 365登录身份验证

我的应用程序中的office 365登录身份验证
EN

Stack Overflow用户
提问于 2018-12-27 13:14:02
回答 1查看 579关注 0票数 0

我们计划为用户提供使用Office 365帐户登录的权限。我想知道任何论坛,以指导整合这一点。

我的应用程序接口: WebAPi (C#)前端: Angular 6

EN

回答 1

Stack Overflow用户

发布于 2018-12-27 14:33:53

请参考以下示例:

代码语言:javascript
复制
   protected void btnLogin_Click(object sender, EventArgs e)   
{  
    bool result = false;  

    HttpResponse < string > response = Unirest.get("https://outlook.office365.com/api/v1.0/me/").basicAuth(txtEmail.Text, txtPassword.Text).asJson < string > ();  

    if (response.Code == 200)  
        result = true;  

    if (result)   
    {  
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User validated successfully')", true);  
    } else  
    {  
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Email/Password is wrong')", true);  
    }  
}  

您将获得如下数据。这是示例数据。

代码语言:javascript
复制
{  
"@odata.context": "https://outlook.office365.com/api/v1.0/$metadata#Me",  
"@odata.id": "https://outlook.office365.com/api/v1.0/Users('yourName@companyName.com')",  
"Id": "yourId",  
"DisplayName": "Your Display Name",  
"Alias": "aliasName",  
"MailboxGuid": "mailBoxGuid"  
} 

有关更多信息,请参阅以下链接:

Authentication With Office 365 In C#

Office 365 Authentication using Visual Studio MVC application

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53940049

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档