When I am trying to sign in my Gmail with existing Geary mail in Freya. It's failed to login. And I don't know the problem. But the username and password both are right.
The simple workaround would be:
Loginto your gmail account
Click on the link : Enable access for less secure apps
Now login to geary. It will work now.
Don't get panic with the word "less secure"
First, use two-factor authorization for your Google account. This will require you to have your phone each time you want to sign in to Google, but it's a really good idea to be vigilant about your Google credentials.
Next, you'll notice that because you have set up two-factor authorization, you won't be able to drop the security level in the link above. Instead, set up an app password for Geary.