0

我正在尝试使用 Google 的 JS API 在当前登录的用户的流/墙/任何内容上发布。我已经到了一切似乎都应该正常工作的地步(我的 chrome js 控制台中没有错误),但我的 google+ 页面上没有显示任何内容。我的代码如下所示:

<html>  
    <head>
    <title>Google+ API Test</title>
    <script type="text/javascript">
        function googleAPIOnLoad() {
            console.log("Google plus js loaded... calling client.load...");
            gapi.client.load('plus','v1', function(e){
                console.log("client loaded...");
                console.log(e);
            });
        }

        function signIn() {
            console.log("signing in...");
            gapi.auth.authorize({
                client_id: "YOUR_CLIENT_ID",
                immediate: false,
                response_type: "token",
                scope: ["https://www.googleapis.com/auth/plus.login"],
                request_visible_actions: "https://schemas.google.com/AddActivity"
            }, function(e) {
                // callback
                console.log("done!", e);

                gapi.client.request({
                    path: "plus/v1/people/me/moments/vault",
                    method: "POST",
                    body: JSON.stringify({
                        type: "http://schemas.google.com/AddActivity",
                        target: {
                            id: "SOME_UNIQUE_ID_12345",
                            type: "http://schema.org/Thing",
                            name: "This is a test",
                            description: "Hi there, this is a test",
                            image: "http://mentationaway.com/wp-content/uploads/2010/08/fractal.jpg"
                        }
                    })
                }).execute(function(e) {
                    console.log("did it.", e);
                });
            });
        }
    </script>
    <script type="text/javascript" src="https://apis.google.com/js/client:plusone.js?onload=googleAPIOnLoad"></script>
</head>
<body>
    <input type="button" value="Sign In" onclick="signIn()">
</body>
</html>`

我显然删除了我的 client_id。我一直在查看此页面(http://wheresgus.com/appactivitiesdemo/),它声称它可以进行活动,但即使我对此进行测试,我仍然在我的 google+ 页面上看不到任何内容。有谁知道我可能做错了什么?

谢谢你的帮助。

4

1 回答 1

0

应用活动出现在 Google+ 上特定于每个应用的特殊位置。要查看您的所有应用活动,请访问:

https://plus.google.com/apps/activities

要按应用查看应用活动,请访问此处:

http://plus.google.com/apps

并选择您要查看活动的应用程序。

于 2013-08-13T02:11:59.877 回答