Skip to content

Authentication params

Juan Gabriel Griggio edited this page Jan 17, 2025 · 13 revisions

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 Recommended Description
gemini_api_key No Yes Used to access Gemini API directly. To obtain, follow instructions here. If Gemini API is blocked by your organization or you are unable to get a Gemini API Key, the Gemini API will be accessed through Vertex AI. This does not change the outcome of the generation and does not affect at all regarding the tool usage.
login_customer_id No Yes 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 Yes 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, client_secret and refresh_token No No Required if you want to use OAuth 2.0 application level authentication, which is not recommended. To obtain, follow steps below.

OAuth steps:

  1. Go to Google Cloud console -> APIs & Services -> Credentials -> + Create credentials -> OAuth Client ID -> Desktop app and obtain your client_id and client_secret.

  2. Download credentials file generated in previous step

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

  4. 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
  5. Open url shown in terminal and follow steps

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

  7. Paste url in terminal and hit enter

  8. Refresh token will be provided

Clone this wiki locally