Authentication params - google-marketing-solutions/topic-mine GitHub Wiki

This section explains how to obtain the keys and tokens required to run Topic Mine that are then put in the config.json file.

Parameters

Parameter Required Description
gemini_api_key Yes Required to use Gemini API. To obtain, follow instructions here.
login_customer_id No Recommended to include. Required to use Google Ads' Keyword Planner. If not included, Topic Mine will use Gemini to generate keywords, which might not yield as precise keywords as the Keyword Planner. Google Ads customer ID, usually at the top right of Google Ads console with a format similar to XXX-XXX-XXXX. Copy without dashes or hyphens.
google_ads_developer_token No Recommended to include. Required to use Google Ads' Keyword Planner. If not included, Topic Mine will use Gemini to generate keywords, which might not yield as precise keywords as the Keyword Planner. To obtain, follow instructions here.
client_id and client_secret No Recommended to skip (not include in the config.json). Needed if you want to use project-level authentication, which is not recommended. To obtain, go to Google Cloud console -> APIs & Services -> Credentials -> + Create credentials -> OAuth Client ID -> Desktop app.
refresh_token No Recommended to skip (not include in the config.json). Needed if you want to use project-level authentication, which is not recommended. To obtain, follow steps below.

refresh_token steps:

  1. Download credentials file generated in previous step

  2. Rename it creds.json and paste inside refresh_token_generator folder

  3. Run refresh_token_generator.py:

    1. Open a terminal
    2. Navigate using the cd command to the folder called refresh_token_generator. If you start with the terminal in the root directory, you must execute the following command:
    cd /refresh_token_generator
    
    1. Check that you are in the right folder with the command ls. It should show just one file called refresh_token_generator.py

    2. Run the following command:

    ./refresh_token_generator.py
    
  4. Open url shown in terminal and follow steps

  5. Once allowed permission, a site unreachable will appear in the web browser. Do not close it, copy the full url from the browser

  6. Paste url in terminal and hit enter

  7. Refresh token will be provided |