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

无法使用 adal4j Api 获取 Azure 令牌

无法使用 adal4j Api 获取 Azure 令牌

大话西游666 2021-09-12 20:00:25
我正在尝试从 Microsoft 图形中读取用户配置文件/图像,并且正在使用 adal4j-1.5.0.jar 生成 azure 令牌,以便基于令牌我可以调用图形 API/Microsoft delve。我在下面的代码中遇到问题。在不生成令牌或任何异常的情况下,在下面的行之后移动到 finally 块很简单。“未来未来 = context.acquireToken(resourceUri, credential, null);”String clientId = "clientid";String clientSecret = "cleintsecret";String resourceUri = "https://graph.microsoft.com/v1.0/me";String redirectUri = "http://localhost:9082/contextroot";String authorityUri ="https://login.microsoftonline.com/{tenent id}/oauth2/authorize";AuthenticationContext context = null;AuthenticationResult result = null;ExecutorService service = null;try {    service = Executors.newFixedThreadPool(1);    context = new AuthenticationContext(authorityUri, false, service);    ClientCredential credential = new ClientCredential(clientId,clientSecret);    Future<AuthenticationResult> future = context.acquireToken(resourceUri, credential, null);    result = future.get();}finally {    service.shutdown();}
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 197 浏览

添加回答

举报

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