避免错误 100:应用程序请求对话框中的参数无效(需要有效的重定向 URI) [英] Avoiding error 100: invalid parameter (requires valid redirect URI) in application requests dialog

查看:13
本文介绍了避免错误 100:应用程序请求对话框中的参数无效(需要有效的重定向 URI)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 Facebook 开发一款游戏.我需要一种方法让用户邀请其他人加入游戏.为此,我使用了 apprequests 对话框.我将用户重定向到对话 URL,我将它们粘合在一起,如下所示:

I'm developing a game for Facebook. I need a way for users to invite others to the game. For that, I use the apprequests dialog. I redirect the user to the dialog URL, which I glue together like this:

$url = "http://www.facebook.com/dialog/apprequests?app_id=".$id."&message=".urlencode("foobar")."&redirect=".urlencode("http://some.arbitrary.url.com");

(当然,使用不那么随意的参数,但它们在我看来仍然很理智.)导航到那里时,用户被API错误代码:100,API错误描述:无效参数,错误消息:需要有效的重定向 URI.".我四处搜寻解决方案,但似乎所有收到此错误的人都忘记了转义他们的 URL/消息.我还尝试了一些无需备注即可接受的 URL,例如应用程序画布 URL.

(Of course, with not-so-arbitrary arguments, but they still look sane to me.) Upon navigating there, the user is scolded by "API Error Code: 100, API Error Description: Invalid Parameter, Error Message: Requires valid redirect URI.". I googled around for a solution, but it seems that all the people receiving this error were forgetting to escape their URLs / messages. I also tried some URLs that should be accepted without remarks, like the application canvas URL.

有人知道我犯了什么错误吗?

Does anyone know what mistakes am I making?

推荐答案

所以,解决方案是使用 redirect_urinot to escape 重定向到的 URL,所以我之前写的代码应该是:

So, turns out the solution is to use redirect_uri and not to escape the URL to redirect to, so the code I wrote before should read:

$url = "http://www.facebook.com/dialog/apprequests?app_id=".$id."&message=".urlencode("foobar")."&redirect_uri="."http://some.arbitrary.url.com";

这篇关于避免错误 100:应用程序请求对话框中的参数无效(需要有效的重定向 URI)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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