使用委托身份验证获取不记名令牌
参考本文授权请求。 如果我的应用程序用户已经登录,我该如何请求使用SDK或此API参考来获取我的配置文件:https://graph.microsoft.com/v1.0/me/
sdk code i写道:
public async Task<string> GetFullNameAsync()
{
try
{
var user = await _client.Me
.Request()
.Select(data => data.DisplayName)
.GetAsync();
return user.DisplayName;
}
catch (Exception ex)
{
return "404 Not Found";
}
}
为此,如何使用上述文章中提到的Web应用程序和.NET Core中的单个租户获得携带者令牌字符串?
With reference to this article Authorization Request.
If my application user is already logged in, how can I request to get my profile using SDK or this API reference: https://graph.microsoft.com/v1.0/me/
SDK code I wrote:
public async Task<string> GetFullNameAsync()
{
try
{
var user = await _client.Me
.Request()
.Select(data => data.DisplayName)
.GetAsync();
return user.DisplayName;
}
catch (Exception ex)
{
return "404 Not Found";
}
}
For that, how can I get a bearer token string using delegated authentication for Web Application and single tenant in .NET Core as mentioned in the above article?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要使用授权身份验证获得携带者令牌,请检查下面是否有用:
ihttpclientFactory
创建HTTPCLIENT实例以创建实例。itokenacquisition
和ihttpclientFactory接口来创建不同范围的grapenapiclient请求。请在下面找到参考以详细了解:
使用asp.net core中的Microsoft Graph API |软件工程(damienbod.com)
.NET CORE API使用载体身份验证-Dotnet Playbook
To get bearer token using delegated authentication, please check the below if helpful:
IHttpClientFactory
to create the HttpClient instance to create instance.ITokenAcquisition
and the IHttpClientFactory interfaces to create the GraphApiClient requests for different scopes.Please find below references to know more in detail:
Using Microsoft Graph API in ASP.NET Core | Software Engineering (damienbod.com)
Secure a .NET Core API using Bearer Authentication - Dotnet Playbook