简体   繁体   English

来自Android应用的Google身份验证发布到Google+

[英]Google auth from android app to post to google+

I authenticate user to google with AccountManager and with scope "oauth2: https://www.googleapis.com/auth/plus.login ". 我使用AccountManager和范围“ oauth2: https : //www.googleapis.com/auth/plus.login ”对用户进行Google身份验证。

I've sent received token to server. 我已将收到的令牌发送到服务器。 Server tries to make moments.insert with my token, but it receives "code": 401, "message": "Unauthorized" 服务器尝试使用我的令牌创建moments.insert,但是它收到“代码”:401,“消息”:“未经授权”

Server just uses my token an "me" as user id. 服务器仅将我的令牌“我”用作用户ID。

Please, help: whether problem is on server side or on client side and what is the problem? 请帮助:问题是在服务器端还是在客户端,这是什么问题?

Thanks! 谢谢!

First, you cannot post activity to Google+ programmatically. 首先,您无法通过编程方式将活动发布到Google+。 The app activities that you can write are specific to your application and appear on a user's profile but not in their stream. 您可以编写的应用程序活动是特定于您的应用程序的,并显示在用户的个人资料中,而不显示在其信息流中。

To use app activities, you must request permissions for the types of app activities that you are writing and pass these to the Google+ client's builder : 要使用应用程序活动,您必须为所编写的应用程序活动类型请求权限,并将这些权限传递给Google+客户的构建器

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();

... ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM