问题
I am using Google Plus integration where I have to fetch circles of user.
I am passing the Url:https://www.googleapis.com/plus/v1/people/Your_User_Id/people/visible?key=APP_Key.
I am getting the response as:
{ error = { code = 403; errors = ( { domain = global; message = Forbidden; reason = forbidden; } ); message = Forbidden; }; }
What kind of permission do I need for This request?
回答1:
You can only do this for the signed in user - so the "Your_User_Id" should always be "me". It's fine to pass the app key as well, but you must be making the call with an oAuth 2.0 token from a user who has signed in to your app. You can see all the details here: https://developers.google.com/+/mobile/ios/people#retrieve_a_collection_of_people
Basically you'd need to implement sign-in, if you haven't already, then you can use the plusService in the GPPSignIn sharedInstance:
GTLQueryPlus *query =
[GTLQueryPlus queryForPeopleListWithUserId:@"me"
collection:kGTLPlusCollectionVisible];
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLPlusPeopleFeed *peopleFeed,
NSError *error) {
if (error) {
GTMLoggerError(@"Error: %@", error);
} else {
// Get an array of people from GTLPlusPeopleFeed
NSArray* peopleList = [peopleFeed.items retain];
}
}];
That is calling the URL that you're giving there.
来源:https://stackoverflow.com/questions/17562691/how-to-fetch-google-plus-circles-in-ios-sdk