Authentication

gformlib supports two authentication strategies.

OAuth 2.0 (desktop / installed apps)

  1. In the Google Cloud Console create an OAuth 2.0 client of type Desktop app and download client_secrets.json.

  2. On the first run, a browser window opens to grant access. The token is cached in token.json for subsequent runs.

from gformlib import GoogleFormsClient

client = GoogleFormsClient.from_oauth_credentials(
    "client_secrets.json",
    token_file="token.json",
)

Required scopes

  • https://www.googleapis.com/auth/forms.body – create and edit forms.

  • https://www.googleapis.com/auth/drive.file – required for file-upload questions and delete_form.