So you want to synchronize your Google contacts with the contacts in Mac OS X, but you have done the smart thing and enabled two factor authentication for your Google account. Not a problem, here’s how to do it.
Open up Contacts.app and go to Contacts > Preferences… (⌘-,) and go to Accounts, there you will see “On My Mac” as an account option.
Click the “Configure…” button, and you will be prompted for your Google account and password. This is where the two factor authentication trick comes into play.
Visit the Google two factor authentication settings page and scroll down to Application-specific passwords. There you will need to supply a meaningful name to your new key (e.g. “Mac OS X Contacts Sync”) and click Generate password. This will create a random string of characters that you will then copy and paste as your password into the Contacts.app preferences screen.
Once you fill that in, proceed with the prompt on the Contacts.app preferences screen. You should see a symbol in your task bar now which only the option “Sync now”. This will pull all your contacts from your Google account, and you’re set, securely!