有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java ADAL如何以编程方式检索oAuth访问令牌

我正在编写一个使用Microsoft Graph API的服务。要检索访问令牌,我已执行以下操作:

  1. 使用基于SOAP的IProvisioningWebService创建了ServicePrincipal w/“公司管理员”角色(假设我将拥有组织管理员凭据)
  2. 然后使用ADAL4J库检索访问令牌

    // clientId = AppPrincipalId created in step#1
    Future<AuthenticationResult> future = context.acquireToken(
            "https://graph.windows.net", clientId, username, password,
            null);
    

我有以下错误,我的方法无效吗

com.microsoft.aad.adal4j.AuthenticationException: {"error":"invalid_grant","error_description":"AADSTS65001: The user or administrator has not consented to use the application with ID 'XXXX '. Send an interactive authorization request for this user and resource.\r\nTrace ID:


共 (0) 个答案