You've essentially got it right, but I think you're getting confused between the "authentication code" and the "application-specific password". iMovie won't work with an authentication code, you need to create an "application-specific password" in your Google account, and use that in iMovie. (just to be clear, the "authentication code" is the four-digit code that you get in a text message or on your phone app, after you use your regular password. The "application-specific password" is a special password that completely bypassses 2-factor authentication - it's not as secure, but lets you continue using programs like iMovie that don't work with 2-factor authentication).
But the problem is that iMovie won't remember your password between restarts, and Google won't show you what the password is after that first time. There are two possible solutions:
- Use "Keychain Access" (or a program like 1Password) on your Mac to securely store your password, you can then retrieve it from Keychain Access and paste it into iMovie the next time you need it (if iMovie did remember your password, this is where it would be stored anyway. You'll find Keychain Access in your "Utilities" folder).
- Every time you use iMovie, go into your Google Account and "revoke" the old iMovie password, then create a new one to use in iMovie.
If you go with my 1st suggestion, make sure you always use something like Keychain Access or 1Password to securely store your passwords. Never save it in a text or Word document or a "note taking" app, etc since those are not secure enough for passwords.