Java 无法从office 365门户打开我的应用程序。获取应用程序错误的未定义登录url

Java 无法从office 365门户打开我的应用程序。获取应用程序错误的未定义登录url,java,azure,azure-active-directory,adal,adal4j,Java,Azure,Azure Active Directory,Adal,Adal4j,我正在将Azure AD登录身份验证集成到我的web应用程序中。我已在azure development portal中创建了一个帐户,并将我的应用程序注册为web应用程序。在应用程序注册设置中,我提供了如下重定向URL 重定向URL: 在我的JavaWeb应用程序中,我实现了在上述端点(azureLogin.html)中获取azure令牌的逻辑。我已经使用ADALJava库实现了下面的代码逻辑 private AuthenticationResult acquireTokenByAuthori

我正在将Azure AD登录身份验证集成到我的web应用程序中。我已在azure development portal中创建了一个帐户,并将我的应用程序注册为web应用程序。在应用程序注册设置中,我提供了如下重定向URL

重定向URL:

在我的JavaWeb应用程序中,我实现了在上述端点(azureLogin.html)中获取azure令牌的逻辑。我已经使用ADALJava库实现了下面的代码逻辑

private AuthenticationResult acquireTokenByAuthorizationCode(String authCode) {
    String authority = System.getProperty("dashboard.azure.authority.url", "https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxx/oauth2/token");
    String clientId = System.getProperty("dashboard.azure.client.id", "xxxxxxxxxxxxxxxxxxxxxxxxx");
    String clientSecret = System.getProperty("dashboard.azure.client.secret", "xxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    String redirectUrl = System.getProperty("dashboard.azure.redirect.uri", "https://mdb-dev-ext.xyzcde.com/my.dashboard/azureLogin.html?");
    AuthenticationResult result = null;
    ExecutorService service = null;
    try {
      service = Executors.newFixedThreadPool(1);
      AuthenticationContext context = new AuthenticationContext(authority, false, service);
      ClientCredential credential = new ClientCredential(clientId, clientSecret);
      Future<AuthenticationResult> future = context.acquireTokenByAuthorizationCode(authCode, URI.create(redirectUrl), credential, null);
      result = future.get();
    } catch (Exception e) {
      LOGGER.error("Error occurred while acquiring token from Azure {}", e.getMessage());
      throw new Exception(String.format("Error occurred while acquiring token from Azure. %s", e.getMessage()));
    }
    return result;
  }
如果我为主页URL字段提供了我的web应用的登录URL,如下所示

主页URL:

然后,当尝试从office 365打开my app时,它将打开my web app的登录页面(在该页面上,它将提示输入应用程序的DB用户名和密码)。这不是我要找的

我想要实现的是->登录到office 365->单击我的web应用按钮->在我的应用注册期间azure门户中提到的重定向URL应加载->这将最终调用我的web应用中编写的代码逻辑来获取azure令牌,并使用存储在会话中的azure返回令牌登录到我的应用

请让我知道我错过了什么。为什么我得到这个未定义的应用程序错误登录URL?在office 365门户中单击我的应用的图标,为什么它不重定向到配置的重定向URL

问题:“您无法访问此应用程序,因为它被错误配置。请与您的it部门联系,并提供以下信息: 信息:应用程序的未定义登录URL“


关于此错误,您需要配置主页url,然后才能修复此错误。有关更多详细信息,请参阅。

问题:在office 365门户中单击我的应用的图标,为什么它不重定向到>配置的重定向URL?


关于这个问题,我认为您遗漏了一些关于登录URL和重定向URL的内容。登录URL和重定向URL不同。通常,登录URL是触发针对AAD登录的URL。重定向url是授权服务器在成功授权应用程序后将用户发送到的位置。

关于此错误,您需要设置主页url。有关更多详细信息,请参阅。此外,登录URL和重定向URL不同。通常,登录URL是触发针对AAD登录的URL。重定向url是授权服务器在成功授权应用程序后将用户发送到的位置。您还有其他问题吗?没有其他问题。谢谢你的问题已经得到答复,你能接受我的答复吗?它可能会帮助更多有类似问题的人。
"You cannot access this application because it has been misconfigured. Contact your IT department and include the following information:
Undefined Sign-On URL for application"