I was just able to convert the GooglePhotosSample application to authentiacte with OAuth by replacing the username/password code in the window controller with this OAuth sign-in code.
- (void)signInWithOAuth {
NSString *scope = [GDataServiceGooglePhotos authorizationScope];
GDataOAuthWindowController *controller = [[[GDataOAuthWindowController alloc] initWithScope:scope
language:nil
appServiceName:kAppServiceName
resourceBundle:nil] autorelease];
[controller signInSheetModalForWindow:[self window]
delegate:self
finishedSelector:@selector(windowController:finishedWithAuth:error:)];
}
- (void)windowController:(GDataOAuthWindowController *)windowController
finishedWithAuth:(GDataOAuthAuthentication *)auth
error:(NSError *)error {
if (error != nil) {
// sign in failed
} else {
NSString *username = [auth userEmail];
[mUsernameField setStringValue:username];
[[self googlePhotosService] setAuthorizer:auth];
[self fetchAllAlbums];
}
}
The sample app was then able to fetch the photos feed successfully.