java - GoogleJsonResponseException for Gooogle+ API -
in android application integrated google+ api, have verified access , scopes. want insert comments , new post in android application. integrated post method google documentation.the reference https://developers.google.com/+/domains/posts/creating
mainactivity.java
//set accesstoken googlecredential credential = new googlecredential().setaccesstoken( token ); // create list of acl entries plusdomainsaclentryresource resource = new plusdomainsaclentryresource(); resource.settype("domain"); // share domain list<plusdomainsaclentryresource> aclentries = new arraylist<plusdomainsaclentryresource>(); aclentries.add(resource); acl acl = new acl(); acl.setitems(aclentries); acl.setdomainrestricted(true); // required, domain restriction // create new activity object com.google.api.services.plusdomains.model.activity activity = new com.google.api.services.plusdomains.model.activity() .setobject(new com.google.api.services.plusdomains.model.activity.plusdomainsobject().setoriginalcontent(comments)) .setaccess(acl); //execute api com.google.api.services.plusdomains.model.activity plusdomains = new plusdomains(common.http_transport, common.json_factory, credential ).activities().insert("me",activity) .execute();
i got below error. refer below links not not working
google coordinate authentication
com.google.api.client.googleapis.json.googlejsonresponseexception: 401 unauthorized w/system.err: { w/system.err: "code" : 401, w/system.err: "errors" : [ { w/system.err: "domain" : "global", w/system.err: "location" : "authorization", w/system.err: "locationtype" : "header", w/system.err: "message" : "invalid credentials", w/system.err: "reason" : "autherror" w/system.err: } ], w/system.err: "message" : "invalid credentials" w/system.err: }
Comments
Post a Comment