包含查询字符串的redirect_uri与配置的重定向URL不匹配

时间:2016-06-17 05:35:02

标签: oauth office365 azure-active-directory

要明确这个问题与Azure AD API的v2.0有关。

我已在应用注册门户中将http://localhost:3000配置为允许的重定向网址(我还尝试了http://localhost:3000/_oauth/azureAd)。

然而,在请求授权代码时,提供包含查询字符串的redirect_uri会导致身份验证失败并显示错误: The reply address 'http://localhost:3000/_oauth/azureAd?close' does not match the reply addresses configured for the application.

在匹配有效的重定向URL时,似乎不会忽略查询字符串。这是一个问题,因为应用程序注册门户网站不允许您使用查询字符串输入重定向URL!

我正在为Meteor编写帐户包以支持Azure AD v2.0,这是Meteor OAuth包正常运行的要求。

我想到的理想解决方案是在验证重定向网址时忽略查询字符串

2 个答案:

答案 0 :(得分:1)

应用程序注册门户不支持查询字符串和无效的特殊字符。

作为解决方法,您可以创建多个重定向URL,而不是使用查询字符串。但您是否介意分享您需要在URL中使用查询字符串的原因?

答案 1 :(得分:1)

您可以通过指定loginStyle配置选项来避免Meteor将?close附加到redirect_uri。请参阅:http://docs.meteor.com/api/accounts.html#Meteor-loginWith

这里解释(下面的代码段):https://github.com/meteor/meteor/blob/abd574f38008b45f5e2a6bc322b10bcdde44763a/packages/oauth/oauth_common.js#L3-L8

  // XXX COMPAT WITH 0.9.0
  // The redirect URI used to have a "?close" query argument.  We
  // detect whether we need to be backwards compatible by checking for
  // the absence of the `loginStyle` field, which wasn't used in the
  // code which had the "?close" argument.
相关问题