我们计划为用户提供使用Office 365帐户登录的权限。我想知道任何论坛,以指导整合这一点。
我的应用程序接口: WebAPi (C#)前端: Angular 6
发布于 2018-12-27 14:33:53
请参考以下示例:
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);
}
} 您将获得如下数据。这是示例数据。
{
"@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
https://stackoverflow.com/questions/53940049
复制相似问题