[英]Facebook signed_request Invalid
So I've been fiddling about with creating a Facebook Page App and am running into an obstacle. 因此,我一直在摆弄创建Facebook Page App的过程,并且遇到了障碍。
The API Documentation ( https://developers.facebook.com/docs/reference/login/signed-request/ ) indicates that it is a json encoded base64 encoded string, but I've found that more often then not it doesn't decode (PHP) properly. API文档( https://developers.facebook.com/docs/reference/login/signed-request/ )指出它是json编码的base64编码的字符串,但我发现它经常不这样做正确解码(PHP)。
Example String 示例字符串
[signed_request] => ccskn7MGtWvG9XXAU5F8nE61aFy-PP-2Jmvz35iwtOo.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTM4NjEyNTk5NCwicGFnZSI6eyJpZCI6IjM5ODYxMDQ0MDIxNDI2NiIsImxpa2VkIjpmYWxzZSwiYWRtaW4iOnRydWV9LCJ1c2VyIjp7ImNvdW50cnkiOiJ1cyIsImxvY2FsZSI6ImVuX1VTIiwiYWdlIjp7Im1pbiI6MjF9fX0 [signed_request] => ccskn7MGtWvG9XXAU5F8nE61aFy-PP-2Jmvz35iwtOo.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTM4NjEyNTk5NCwicGFnZSI6eyJpZCI6IjM5ODYxMDQ0MDIxNDI2NiIsImxpa2VkIjpmYWxzZSwiYWRtaW4iOnRydWV9LCJ1c2VyIjp7ImNvdW50cnkiOiJ1cyIsImxvY2FsZSI6ImVuX1VTIiwiYWdlIjp7Im1pbiI6MjF9fX0
I did find this other question ( Invalid base64 in Facebook signed_request documentation example ), but after trying to add padding, still not gibberish results. 我确实找到了另一个问题( Facebook签名请求文档示例中的base64无效 ),但是在尝试添加填充后,仍然没有出现混乱的结果。
Any help is appreciated. 任何帮助表示赞赏。
To parse the signed_request
, first it must be split at the first dot .
要解析
signed_request
,首先必须在第一个点处将其拆分.
character, and then in the second part you have to replace the characters -
and _
by +
and /
respectively – and after that base64-decode it. 字符,然后在第二部分中,必须分别用
+
和/
替换字符-
和_
,然后对base64进行解码。
As for your question, where this is documented – in the document that is linked right on top of the document that you mentioned, here: https://developers.facebook.com/docs/facebook-login/using-login-with-games/#parsingsr 至于您的问题,该内容记录在哪里–在您提到的文档顶部上链接的文档中,这里: https : //developers.facebook.com/docs/facebook-login/using-login-with-游戏/#parsingsr
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.