为了账号安全,请及时绑定邮箱和手机立即绑定

如何从访问令牌中获取用户详细信息

如何从访问令牌中获取用户详细信息

C#
至尊宝的传说 2021-10-24 19:32:41
我下载了这个示例:https : //github.com/Microsoft/PowerBI-Developer-Samples/tree/master/User%20Owns%20Data/integrate-report-web-app/PBIWebApp我能够获得访问令牌。接下来,我将此访问令牌保存在我的数据库中以备将来使用。使用存储在数据库中的这个令牌,我想获取用户的个人资料,但不知道如何去做。public string GetAccessToken(string authorizationCode, string applicationID, string applicationSecret, string redirectUri)        {            //Redirect uri must match the redirect_uri used when requesting Authorization code.            //Note: If you use a redirect back to Default, as in this sample, you need to add a forward slash            //such as http://localhost:13526/            // Get auth token from auth code                   TokenCache TC = new TokenCache();            //Values are hard-coded for sample purposes            string authority = Settings.Default.AADAuthorityUri;            AuthenticationContext AC = new AuthenticationContext(authority, TC);            ClientCredential cc = new ClientCredential(applicationID, applicationSecret);            //Set token from authentication result            return AC.AcquireTokenByAuthorizationCode(                authorizationCode,                new Uri(redirectUri), cc).AccessToken;        }我检查了 AuthenticationContext 类的方法,但它没有像“GetMe”之类的任何方法。任何帮助表示赞赏。
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 217 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信