I'm using google-api-nodejs-client to get profile information and to login with Google. I want the iOS client to login to Google through my server.
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error {
if (error) {
NSLog(@"Error: %@", error);
abort();
} else {
NSString *serverCode = [GPPSignIn sharedInstance].homeServerAuthorizationCode;
NSURLRequest * urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:1337/auth/google/callback?code=%@",serverCode]]];
NSURLResponse * response = nil;
NSError * error = nil;
[NSURLConnection sendSynchronousRequest:urlRequest
returningResponse:&response
error:&error];
NSLog(@"%@, %@",[response description], serverCode);
[self refreshInterface];
}
}
finishedWithAuth:
returns the following error:
json={
error = "invalid_audience";
"error_description" = "The audience client and the client need to be in the same project.";
}}
What is the audience and how do we add the client ID to our server?
Thanks!
This means that your iOS client ID and web/server client ID do not have matching project numbers. Client IDs are set up like:
${PROJECT_NUMBER}-${ID_HASH}.apps.googleusercontent.com
One way you can fix this is by recreating the client IDs.