【问题标题】:Live id authentication for asp.net MVC site redirect uri not validasp.net MVC 站点重定向 uri 的实时 id 身份验证无效
【发布时间】:2014-11-12 09:05:00
【问题描述】:

我正在尝试在我的 asp.net Web 应用程序中使用实时 ID 身份验证。 我按照以下帖子中的步骤进行操作

http://www.benday.com/2014/02/25/walkthrough-asp-net-mvc-identity-with-microsoft-account-authentication/

在本地主机中创建应用程序和设置域工作正常。 在应用设置中设置重定向 url 是一个问题。当我运行应用程序时,它会提示错误

“为输入参数“redirect_uri”提供的值无效。 预期值为 'https://login.live.com/oauth20_desktop.srf' 或与为此客户端应用程序注册的重定向 URI 匹配的 URL。"

我试过“http://www.mysampleapp.com/Account/ExternalLoginCallback”和“http://www.mysampleapp.com/signin-microsoft”。以及它不起作用的网址。 (mysampleapp 是我在本地托管的 url)

当我点击外部身份验证部分中的“Microsoft”时,我会被定向到以下网址

"https://login.live.com/err.srflc=1033#error=invalid_request&error
_description=The%20provided%20value%20for%20the%20input%20parameter%20'redirect_uri'%
20is%20not%20valid.%20The%20expected%20value%20is%20'https://login.live.com/oauth20_desktop.srf
'%20or%20a%20URL%20which%20matches%20the%20redirect%20URI%20registered%20for
%20this%20client%20application."

有什么办法可以查到网址吗?

【问题讨论】:

    标签: asp.net-mvc


    【解决方案1】:

    如果您使用的是新的 Microsoft Live 应用程序设置 然后重定向 URL:http://something.yourDomain.com/signin-microsoft

    如果您使用的是旧版 Microsoft Live 应用程序设置 然后重定向 URL:http://something.yourDomain.com/Account/ExternalLoginCallback

    请注意:“某事”不应是 www。

    不要使用www,将其替换为某种子域名并在主机文件中正确设置。这就是我如何在我之前的项目中进行这项工作以在本地进行测试。

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      尝试将此http://myapp-url/signin-microsoft 设置为设置重定向 URL。

      【讨论】:

      • 这个网址与我在问题中提到的网址有何不同?它对我不起作用
      • 如果它不起作用,那么使用类似 firebug 的东西来查看对 oauth 提供者的请求是什么样的,然后无论该请求中的重定向 uri 是什么,都是您需要使用的......跨度>
      猜你喜欢
      • 1970-01-01
      • 2020-02-17
      • 2013-02-14
      • 2015-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多