在开发过程中将redirect_uri设置为什么? [英] What to set redirect_uri to during development?

查看:371
本文介绍了在开发过程中将redirect_uri设置为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我刚刚开始使用Live Connect API,以便连接到OneDrive。

I am just starting out with the Live Connect API with a view to connecting up to OneDrive.

我有遇到问题,无法在任何地方找到答案。很多参考javascript SDK  WL.init()方法的redirect_uri参数,但我无法弄清楚如何用它实际开发。

I have run into a problem and can't find the answer anywhere. Much reference is made to the redirect_uri parameter of th javascript SDK WL.init() method but I can't figure out how to actually develop with it.

我正在开发一个ASP.NET MVC 5网站(它实际上是一个MVC / WebForms混合体)。这在IIS Express中的开发平台上运行。

I am developing an ASP.NET MVC 5 website (it's actually an MVC/WebForms hybrid). This runs up on my dev platform in IIS Express.

我应该将redirect_uri设置为什么?一切都告诉我它必须设置为公开的URI(例如实时网站uri)但是如何让它在开发时工作?

What should I set redirect_uri to? Everything tells me that it must be set to a publicly available URI (eg the live website uri) but how do I get it to work at dev time?

我尝试了各种localhost组合等无济于事。当我使用live uri时,它在我的实时服务器上运行回调,并且我没有触发auth.sessionChange事件(可以理解 - 它正在为我的现场uri配置cookie,我猜)。

I have tried various combinations of localhost etc to no avail. When I use the live uri it runs the callback on my live server and I don't get the auth.sessionChange event firing (understandably - it's configuring the cookie for my live uri, I assume).

我已经浏览了在线文档,似乎从为实时系统设置这一点开始。

I have gone through the online documentation and it all seems to start from the viewpoint of setting this up for a live system.

我只是继续遇到"输入参数'redirect_uri'提供的值无效。预期值为"https://login.live.com/oauth20_desktop.srf"或与此客户注册的重定向URI匹配的URL "错误。

I just kept running into the "The provided value for the input parameter 'redirect_uri' is not valid. The expected value is 'https://login.live.com/oauth20_desktop.srf' or a URL which matches the redirect URI registered for this client " error.

我现在已经禁用了应用程序的增强重定向安全性,但仍然将其设置为我的实时uri但是由于我在我的开发平台上运行该站点而感觉不太可行将其配置为OAuth在现场验证。

I have now disabled Enhanced redirection security for the app but still have it set to my live uri but this feels unlikely to work since I am running up the site on my dev platform and configuring it to OAuth authenticate on the live one.

那么,你如何使用redirect_uri开发这个API?

So, how do you go about developing with this API with the redirect_uri?

问候,

Graeme

推荐答案

这是在文档中:

This is in the documentation:

http://msdn.microsoft.com/en-us/library/live/hh826547。 aspx

在开发网络应用时,它是 在将应用程序部署到Web服务器之前,可以方便地在本地计算机上测试应用程序。但是,Live Connect API要求重定向URL使用配置应用程序客户端ID的同一域。
本地计算机的Web服务器可能使用默认地址,如 http:// localhost ,因此您必须将域映射到本地Web服务器的Internet协议(IP)地址。为此,您需要在计算机上的
主机文件中添加映射。 (主机文件的作用是将主机名映射到IP地址。)在Windows计算机上,
主机文件位于 \ Windows\System32\drivers\etc\hosts 即可。在Mac OS X和大多数Unix计算机上,它位于
/ private / etc / hosts 。格式是IP地址,然后是要映射的域,如下所示。

When you are developing a web app, it is  convenient to test the app on a local computer before you deploy it to a web server. However, the Live Connect APIs require the redirect URL to use the same domain at which the app's client ID was configured. Your local computer's web server probably uses a default address like http://localhost, so you must map your domain to the Internet Protocol (IP) address of your local web server. To do this, you add a mapping to the hosts file on your computer. (The job of the hosts file is to map host names to IP addresses.) On Windows computers, the hosts file is located at \Windows\System32\drivers\etc\hosts. On Mac OS X and most Unix computers, it is located at /private/etc/hosts. The format is the IP address, followed by the domain to map, like this.



这篇关于在开发过程中将redirect_uri设置为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆