To manually do this, the user will click the verification link in the email sent by Gmail. I wonder how to easily automate this? Does Google provides an API to do this? And without needing to ask the user's permission first.
I know that this is possible since I tried some apps that automatically confirms Gmail autoforwarding verification after Gmail sent the verification email to the forwarding address.
Programmatically parse the verification link from the email and perform a GET request to that URL.
Note: You don't need to be logged in to Google when visiting that link.