如何解决OAuthException:(#100) [英] how to resolve OAuthException: (#100)

查看:132
本文介绍了如何解决OAuthException:(#100)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用我最近开发的fb应用程序发布在我的墙上,并显示以下错误

I use my recently develop fb app to post on my wall and its shows the following error

未捕获OAuthException:(#100)图片网址不

,您也可以直接看到 * https://apps.facebook.com/hack-proof_pages/1gp.html

使用两个文件1gp .html和gp1.php

using two files "1gp.html" and "gp1.php"

1gp.html代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="gp1.php">
  <p>message
    <textarea style="width:300px; height:50px;" name="message1"></textarea>
</p>
  <p>link 
    <input type="text" style="width:300px;" name="link1" />
  </p>
  <p>
    Picture 
    <input type="text"  name="picture1" />
</p>
  <p>
    name 
    <input type="text" style="width:300px;" name="name1" />
</p>
  <p>
    Caption
    <input type="text" style="width:300px;" name="caption1" />
</p>
  <p>Description
    <textarea style="width:300px; height:50px;" name="description1"></textarea>
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit" />
  </p>
</form>
</body>
</html>

gp1.php代码

<?php 

require_once 'library/facebook.php';

// Create our Application instance.
$facebook = new Facebook(array(
  'appId' => '149865361795547',
  'secret' => 'shhhh seceret :)',
  'cookie' => true,
)); 

     $app_id = '149865361795547';

     $canvas_page = "https://apps.facebook.com/hack-proof_pages/gp1.php";


     //get data for post

     $message1 = $_POST['message1'];
     $picture1 = $_POST['picture1'];
     $name1 = $_POST['name1'];
     $link1  = $_POST['link1'];
     $caption1 =  $_POST['caption1'];
     $description1  = $_POST['description1'];

     // compile the post for for user
    $WallPost = array(
        'message' => $message1,
'link' => $link1,
'picture' => $picture1,
'name' => $name1,
'caption' => $caption1);  // you can also use 'picture', 'link', 'name', 'caption', 'description', 'source'.... 
    //http://developers.facebook.com/docs/reference/api/


         $auth_url = "http://www.facebook.com/dialog/oauth?client_id=" 
            . $app_id . "&redirect_uri=" . urlencode($canvas_page) . ("&scope=email,read_stream,publish_stream,offline_access,publish_actions,manage_pages,user_groups&response_type=token");

     $signed_request = $_REQUEST["signed_request"];

     list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

     $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

     if (empty($data["user_id"])) {
            echo("<script> top.location.href='" . $auth_url . "'</script>");
     } else {

     //getting the userid and some other data for verification 

     //get the user id 
            $UserId = $data["user_id"];
            echo 'UserId;' . $UserId;

    //get the user access token
            $atoken = $facebook->getAccessToken();
            echo "</br>" . 'User Access_Token:' . $atoken;

    //set default access token and profile
            //$facebook->setAccessToken($atoken);
            //$user_profile = $facebook->api('/me');

     //get the user name and email
            $user_id = $facebook->getUser();
            $user_profile = $facebook->api('/me','GET');
            $user_name = $user_profile['name'];
            echo "Name: " . $user_name;
            $user_email = $user_profile['email'];
            echo "email: " . $user_email;

    // post to user wall
            $response = $facebook->api('/me' . '/feed','POST',$WallPost);


    //posting to groups wall with sleeping time support poster.xls


} 
?>

* 注意:我的应用程序使用自签名证书SSL,想要测试这个上面的URL,你需要允许我的网站和存储其证书和一个更多的信息,有时谷歌Chrome显示错误,由于谷歌chrome一个弱点,铬需要存储自签名证书在互联网浏览器意味着如果你想检查在chrome中,您需要首先在互联网浏览器中打开此网站,并允许我的站点自签名证书并永久存储,以使其也可以在chrome中工作

*Note: my app use self signed certificate SSL so that if you want to test this above URL you need to allow my site and store its certificate and one more info that sometimes google chrome shows error due to google chrome one weak point that chrome needs to store self signed certificate in internet explorer means if you want to check this in chrome you need to first open this site in internet explorer and allow my site self signed certificate and store permanently so that its also work in chrome

推荐答案

请检查您的图片网址,您需要提供照片的完整网址,而不是相关网址和Facebook应该能够访问图片网址,即它不应该是您本地托管的应用程序,请尝试放置任何图片的全面合格样本网址代码和检查。

Please check your picture url, you need to give the full url of the photo not the relative url and facebook should be able to access the picture url, i.e. it should not be of your locally hosted application, try placing a fully qualified sample url of any picture in ur code and check.

这篇关于如何解决OAuthException:(#100)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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