谷歌授权从Android应用程序发布到谷歌+

时间:2013-12-19 16:15:01

标签: android oauth-2.0 google-plus

我使用AccountManager对用户进行google身份验证,范围为“oauth2:https://www.googleapis.com/auth/plus.login”。

我已将收到的令牌发送到服务器。服务器尝试使用我的令牌创建moment.insert,但它收到“代码”:401,“message”:“Unauthorized”

服务器只使用我的令牌“me”作为用户ID。

请帮助:问题出在服务器端还是客户端,问题是什么?

谢谢!

1 个答案:

答案 0 :(得分:0)

首先,您无法以编程方式向Google+发布活动。您可以编写的应用活动特定于您的应用,并显示在用户的个人资料中,但不会显示在他们的信息流中。

要使用应用活动,您必须为您正在撰写的应用活动类型申请权限,并将这些活动传递给Google+ client's builder

private PlusClient mPlusClient;

private static final String[] actions = {
    "https://developers.google.com/+/plugins/snippet/examples/thing" 
};

mPlusClient = new PlusClient.Builder(this, this, this)
    .setActions(actions)
    .build();

...