Login to your google account, click the Tool icon near the upper-right corner of the window (it looks like a gear) and select Settings. Click the Accounts and Import tab, then the Other Google Account settings link, near the top of the page.
On the new page, click the Security tab. (You'll find an illustrated version of these instructions in the earlier article.)
Now click the Settings link next to “App passwords.” You may have to enter your password again.
This takes you to the App passwords page. You'll find a list of your existing app passwords (assuming you have any). Below the list, you'll find a simple form for generating an app-specific password. Select the type of app, the type of device, and click Generate.
Google will generate and display a password that you can enter into the app's password field. This password will only work for that particular program, and will only be displayed this once (so have your device or app ready). You can stop access to your account from an app password by clicking the appropriate Revoke button on the Apps password page.
You'll only have to do this once for each app.