【发布时间】:2015-07-08 10:20:38
【问题描述】:
我有一个带有 EF 的 Web API 后端,并使用 AzureAD 对我的 (office365) 用户进行身份验证,该用户使用 AngularJS 编写的 Web 应用程序。
现在我想在我的 Web API 中创建一个草稿邮件,但我不知道从哪里开始。
我可以只在我的 Web API 中调用 Office 365 邮件 API 吗? 发布https://outlook.office365.com/api/{version}/me/sendmail
但是我如何通过它传递身份验证令牌?
这是我现在使用的身份验证配置,它适用于其他数据请求。
public static class Auth
{
internal static void ConfigureCors(this IAppBuilder app)
{
// TODO: Configure to only allow ESS Web UI
app.UseCors(CorsOptions.AllowAll);
}
internal static void ConfigureAuth(this IAppBuilder app)
{
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = Settings.Default.Audience
},
Tenant = Settings.Default.Tenant
});
}
}
任何人有一些示例代码可以向 Office 365 API 发出正确请求吗?谢谢!我是 Office 365 API 和此网站的新手: https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations
我不太清楚如何处理这个..
【问题讨论】:
标签: c# asp.net-web-api office365 bearer-token outlook-restapi