Javascript 为输入参数提供的值';重定向uri';无效
我一直从windows live收到此错误 为输入参数“redirect_uri”提供的值不正确 有效。期望值为 'https://login.live.com/oauth20_desktop.srf'或匹配的URL 重定向 为什么我一直收到这个错误。我在windows live开发者应用程序中设置了域 在我拥有的元素中Javascript 为输入参数提供的值';重定向uri';无效,javascript,phpbb,phpbb3,windows-live,Javascript,Phpbb,Phpbb3,Windows Live,我一直从windows live收到此错误 为输入参数“redirect_uri”提供的值不正确 有效。期望值为 'https://login.live.com/oauth20_desktop.srf'或匹配的URL 重定向 为什么我一直收到这个错误。我在windows live开发者应用程序中设置了域 在我拥有的元素中 <script src="//js.live.net/v5.0/wl.js"></script> WL.init({ client_id:
<script src="//js.live.net/v5.0/wl.js"></script>
WL.init({
client_id: '{S_AL_WL_CLIENT_ID}', //{S_AL_WL_CLIENT_ID} = phpbb template variable for client_id
redirect_uri: '{AL_BOARD_URL}', //{AL_BOARD_URL} = phpbb template variable for the urlencoded domain name
response_type: 'token',
scope: ["wl.signin", "wl.basic", "wl.birthday", "wl.emails", "wl.work_profile", "wl.postal_addresses"]
});
登录按钮是
<div id="login">
<a href="#"><img src="images/windows_live_connect.png" alt="Windows Live" /></a>
</div>
问题是重定向uri必须精确地
http://www.yourdomain.com
而非http://yourdomain.com
。
因此,如果用户输入http://yourdomain.com
则会显示此错误,但如果用户有http://www.yourdomain.com
然后脚本开始工作
我想我已经被Facebook Api宠坏了
因此,最后我只是使用登录按钮创建了一个正则表达式来匹配任何url,并强制它为www with.htaccess。还添加了
http://yourdomain.com
而不是http://www.yourdomain.com
由于app domain@windows live app部分允许使用这两种类型的域名,但会导致cookie错误。我面临同样的问题,但我的弹头每次都是动态的,每次都不一样,有什么解决办法吗?
jQuery('#login a').click(function(e)
{
e.preventDefault();
WL.login({
scope: ["wl.signin", "wl.basic", "wl.birthday", "wl.emails", "wl.work_profile", "wl.postal_addresses"]
}).then(function (response)
{
//do something with stuff here. You know brainy type ajaxy stuff to auth a user
},
function (responseFailed)
{
console.log("Error signing in: " + responseFailed.error_description);
});
});