Chromium отсутствуют ключи api google
Sometimes you need to use API Keys to use things like the Speech API. And then you Google a bit and follow all the instructions. But the Chromium Project's API Keys page does a not-so-great of explaining how to do this, so I will.
- Download Chromium.
- You'll notice a yellow disclaimer message appear as a doorhanger: Google API Keys are missing. Some functionality of Chromium will be disabled. Learn More .
- Clicking on that link takes you to the confusing API Keys docs page.
- If you aren't already, subscribe to the chromium-dev@chromium.org mailing list. (You can just subscribe to the list and choose to not receive any mail. FYI: the Chromium project restricts the APIs to those subscribed to that group - that is, Chromium devs.)
- Make sure you are logged in with the Google account associated with the email address that you used to subscribe to chromium-dev.
- Log in to the Google Cloud Platform, and select an existing project or press the "Create Project" button.
- From the project's API Manager, select the Credentials tab in the sidebar.
- Create a Browser API Key.
- You'll see a modal with an API key. Copy and paste that somewhere.
- Now create an OAuth Client ID.
- After you complete all the steps and the "content screen," you'll be presented with a modal with your Google Client ID and Client Secret.
- You'll need to set three environment variables:
On Windows: Launch cmd.exe and enter the following commands:
On Mac OS X / Linux: Plop these in your ~/.profile file:
Now launch Chromium:
On Windows: Launch Chromium normally.
On Mac OS X:
uBlock-user commented Jul 22, 2017
@cvan This doesn't work for built in translation for Chromium. I followed the steps and installed the keys and secret, but when I right click and click on Translate in English it fails.
Open the context menu via a right click and click on Translate in English, it will fail with a notification from the browser
Open the console via F12 and you will find this - Failed to load resource: the server responded with a status of 403 ()
PS - This only happens to me on Chromium and not Chrome. Why ? Please explain.
DAC324 commented Apr 29, 2021 •
lopugit commented Dec 15, 2019
Dude thank you so much. Epic.
Ответы 6
Чтобы выполнять аутентифицированные запросы к Google Translation, вы должны создать объект службы с учетными данными или использовать ключ API. Самый простой способ аутентификации - использовать Учетные данные приложения по умолчанию. Эти учетные данные автоматически выводятся из вашей среды, поэтому для создания объекта службы вам понадобится только следующий код:
Я лично никогда не заставлял это работать.
Этот код также можно использовать с ключом API. По умолчанию ключ API ищется в переменной среды GOOGLE_API_KEY . После установки ключа API вы можете выполнять вызовы API, вызывая методы в службе перевода, созданной с помощью TranslateOptions.getDefaultInstance().getService() .
Я разместил изображение в своем вопросе. Я не уверен, правда ли? Или мне нужно установить его в переменной Path .
@ user1694733 однако я получил следующее: "message": "Ваше приложение прошло аутентификацию с использованием учетных данных конечного пользователя из Google Cloud SDK или Google Cloud Shell, которые не поддерживаются translate.googleapis.com. Мы рекомендуем, чтобы большинство серверных приложений использовали сервис вместо этого. Дополнительные сведения об учетных записях служб и их использовании в приложении см. в разделе cloud.google.com/docs/authentication. ",
Я использую Chromium Portable в Windows в среде, которая не сохраняет ничего после перезагрузки. При каждом запуске программы он жалуется на отсутствие ключа API (см. Снимок экрана на немецком языке). Ссылка на дополнительную информацию ведет на вики-страницу Chrome, где первое требование для получения такого ключа гласит: Make sure you are a member of [email protected] это как бы говорит мне, что это не то, что я хочу, я просто хочу использовать этот браузер. Я просмотрел пару выпусков этого портативного пакета, и он существует довольно долго, и я ничего не настраивал. Это что-то, что разработчики пакетов забыли отключить? Как мне от этого избавиться?
- 1 Это похоже на ошибку в текущем выпуске. Убедитесь, что проблема существует в предыдущем выпуске, если ее нет, сообщите о проблеме.
- 1 Вам нужно только подписаться на этот список рассылки, чтобы получить доступ к API и сгенерировать ключи API.
Из Chromium Portable Help.html:
Chromium Portable имеет несколько настроек, которые влияют на поведение средства запуска и браузера. Их можно установить, создав файл с именем ChromiumPortable.ini вместе с ChromiumPortable.exe.
Файл ChromiumPortable.ini состоит из строк в формате ключ = значение. Действующие ключи перечислены ниже.
Ключи доступа к API Google. Более подробная информация доступна на сайте разработки Chromium. Обратите внимание, что разделители (: :) окружены одним пробелом с каждой стороны.
- Вы создаете новый ChromiumPortable.ini и игнорируете тот, который находится в PortableApps \ ChromiumPortable \ App \ AppInfo \ Launcher?
- Хорошо, я так думаю, раз уж это сработало.
Portable X-Chromium 37.0.2007.0 НЕ имеет этой проблемы.
Просто скачайте и запустите.
Всего три года спустя я действительно обнаружил, что это так же просто, как определить
alswl commented Oct 14, 2019
Modify the Info.plist file maybe a better solution.
bogdan-13 commented May 2, 2021 •
Sync still isn't working for me. Chromium no longer complains about not having API keys and now has a "turn on sync" button but after clicking it and logging in with Google it takes me back to new tab and nothing has changed.
htr3n commented Oct 14, 2019
@alswl: I'm not sure touching the bundle is better (never try nor want to) as it's will be overwritten in the next update/upgrade? How can it sustain upgrading Chromium in macOS?
As far as Chromium still honours environment variables, setting environment variables still works, I suppose.
uBlock-user commented Jul 22, 2017
@cvan This doesn't work for built in translation for Chromium. I followed the steps and installed the keys and secret, but when I right click and click on Translate in English it fails.
Open the context menu via a right click and click on Translate in English, it will fail with a notification from the browser
Open the console via F12 and you will find this - Failed to load resource: the server responded with a status of 403 ()
PS - This only happens to me on Chromium and not Chrome. Why ? Please explain.
Providing Keys at Build Time
If you are building Chromium yourself, you can provide keys as part of your build configuration, that way they are always baked into your binary.
Specify three variables in your args.gn file (which you can edit by running gn args out/your_out_dir_here )
Acquiring Keys
Make sure you are logged in with the Google account associated with the email address that you used to subscribe to chromium-dev.
Click on the dropdown next to "Google Cloud Platform" and select Create Project (upper right).
(Optional) You may add other members of your organization or team on the Team tab.
Open the APIs and Services > Library from the hamburger menu, search for all of the following APIs. If you're a member of the chromeos-dev Google group you should see all of them. For each of these APIs click on them when found by the search, and then click on "Enable API" button at the top, read and agree to the Terms of Service that is shown, check the "I have read and agree to Terms of Service" checkbox and click Accept: (This list might be out of date; try searching for APIs starting with "Chrome" or having "for Chrome" in the name.)
- Cloud Search API
- Geolocation API (requires enabling billing but is free to use; you can skip this one, in which case geolocation features of Chrome will not work)
- Google Drive API (enable this for Files.app on Chrome OS and SyncFileSystem API)
- Safe Browsing API
- Time Zone API
- Optional
- Admin SDK
- Cloud Translation API
- Geocoding API
- Google Assistant API
- Google Calendar API
- Nearby Messages API
If any of these APIs are not shown, recheck step 1.
Go to the Credentials sub tab under the API & Services section in the hamburger menu.
Click the "Create credentials" button then click on the OAuth client ID item in the drop-down list.
- Click on the "Configure consent screen" button. Fill in the "Product name" (name it anything you want) and other details if you have available then click on "Save" at the bottom.
- Return to the Credentials tab and click the "Add credentials" button again, then select "OAuth 2.0 client ID" from the drop-down list.
- In the "Application type" section check the "Other" option and give it a name in the "Name" text box, then click "Create"
In the pop-up window that appears you'll see a client ID and a "client secret" string. Copy and paste those in a text file on your dev box then click OK to dismiss it.
- A new item should now appear in the "OAuth 2.0 client IDs" list. You can click on the name of your client id to retrieve the ID and secret at any time. In the next sections, we will refer to the values of the “Client ID” and “Client secret” fields.
Click the Create credentials button again on the same page.
- In the pop-over window that shows up click the API key button.
- A pop-over should show up giving you the API key. Copy and paste it in a text file to save it, although you can access it later as well.
- Click OK to dismiss this.
You should now have an API key and a OAuth 2.0 client ID in on the Credentials tab. The next sections will refer to the value of the “API key” field too.
Note: that the keys you have now acquired are not for distribution purposes and must not be shared with other users.
AkiSakurai commented Jun 13, 2021
I want to create OAuth client ID for Chromium on Android. What Application type should I choose when I create the OAuth client ID?
I chose "Web Application" and sync does not work. I have completed all previous steps.
Thank you for guide!Android chromium use GoogleAuthUtil to retrieve tokens. It does not use outh client Id specified in args.gn, instead it delegate the process to google play services, which is guarded by whitelisting fingerprint of apps signature. Currently it is restricted to official build only.
Note: Software distribution with keys acquired for yourself is allowed, but the keys themselves cannot be shared with parties outside the legal entity that accepted the API ToS. Keep in mind that a number of the APIs will have no or very limited quota and not all of the APIs have additional quota available for purchase.
Googlers only:
How-to:
First, acquire API keys. Then, specify the API keys to use either when you build Chromium, or at runtime using environment variables.
Signing in to Chromium is restricted
Note: Starting with Chromium M69, when the browser is set up with an OAuth 2.0 client ID and client secret, signing in with your Google Account to any Google web property will also attempt to sign you in to Chromium (which will fail as explained above). To avoid such errors, remove your OAuth 2.0 client ID and client secret from your build to stop generating tokens when users sign in to Google web properties (remove google_default_client_id, google_default_client_secret from gn args and GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET from your environment settings).
IamCarbonMan commented May 2, 2021
Sync still isn't working for me. Chromium no longer complains about not having API keys and now has a "turn on sync" button but after clicking it and logging in with Google it takes me back to new tab and nothing has changed.
gsitreble2019 commented May 13, 2021 •
These 3 links work for me! Only!
Thanks!uBlock-user commented Aug 7, 2018 •
Polyfilling chrome.identity API in Your Chromium Derivative
The default Chromium chrome.identity.getAuthToken API that extensions may call to obtain auth tokens will fail outside of Google Chrome as the implementation uses restricted APIs.
A prototype CL for Chromium embedders might use to replace the implementation with one not dependent upon private APIs can be found attached to this post.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Open with Desktop
- View raw
- Copy raw contents Copy raw contents
Copy raw contents
Copy raw contents
When using a custom build, fork, or integration of Chromium, or if you're building ChromiumOS, you will need access to Google API for key functionality.
*** note Note: Software distribution with keys acquired for yourself is allowed, but the keys themselves cannot be shared with parties outside the legal entity that accepted the API ToS. Keep in mind that a number of the APIs will have no or very limited quota and not all of the APIs have additional quota available for purchase.
Googlers only:
How-to: First, acquire API keys. Then, specify the API keys to use either when you build Chromium, or at runtime using environment variables.
Make sure you are logged in with the Google account associated with the email address that you used to subscribe to chromium-dev.
optional You may add other members of your organization or team on the Team tab.
Open the APIs and Services > Library from the hamburger menu, search for all of the following APIs. For each of these APIs:
- Click on it
- Click Enable API button at the top
- Read and agree to the Terms of Service
- Check the I have read and agree to the Terms of Service checkbox
- Click Accept.
List of APIs (if any are not shown, recheck step 1 above):
- Cloud Search API
- Geolocation API (requires enabling billing but is free to use; you can skip this one, in which case geolocation features of Chrome will not work)
- Google Drive API (enable this for Files.app on Chrome OS and SyncFileSystem API)
- Safe Browsing API
- Time Zone API
- Optional
- Admin SDK
- Cloud Translation API
- Geocoding API
- Google Assistant API
- Google Calendar API
- Nearby Messages API
Go to the Credentials sub tab under the API & Services section in the hamburger menu.
Click the Create credentials button then click on the OAuth client ID item in the drop-down list.
- Click on the Configure consent screen button. Fill in the "product name" (anything you choose) and other details, then click on Save .
- Return to the Credentials tab and click the Add credentials button again, then select "OAuth 2.0 client ID" from the drop-down list.
- In the "Application type" section check the Other option and give it a name in the "Name" text box, then click Create .
In the pop-up window that appears, you'll see a client ID and a Client secret string. Copy and paste those in a text file on your dev box then click OK to dismiss. A new item should now appear in the OAuth 2.0 client IDs list. You can click on the name of your client ID to retrieve the ID and secret at any time. In the next few sections, these values will be referred to as the Client ID and Client secret fields.
Click the Create credentials button again on the same page.
- In the pop-over window that shows up, click the API key button.
- A pop-over should show up giving you the API key. Copy/paste in to a text file to save, although you will be able to access this as well.
- Click OK to dismiss.
You should now have an API key and an OAuth 2.0 client ID in the Credentials tab. The next sections will refer to the value as the "API key".
*** note Note: Your keys are not for distribution, and should not be shared with others.
Providing Keys at Build time
If you are building Chromium yourself, you can provide keys as part of your build configuration, that way they are always baked into your binary.
Specify three variables in your args.gn file (edit by running gn args out/your_out_dir_here )
Providing Keys at Runtime
If you prefer, you can build a Chromium binary (or use a pre-built Chromium binary) without API keys baked in, and instead provide them at runtime. To do so, set the environment variables GOOGLE_API_KEY , GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET to your "API key", "Client ID" and "Client secret" values respectively.
On Chromium OS to specify the keys as environment variables append them to the end of /etc/chrome_dev.conf :
Signing in to Chromium is restricted
*** note Note: Starting with Chromium M69, when the browser is set up with an OAuth 2.0 client ID and client secret, signing in with your Google Account to any Google web property will also attempt to sign you in to Chromium (which will fail as explained above). To avoid such errors, remove your OAuth 2.0 client ID and client secret from your build to stop generating tokens when users sign in to Google web properties (remove google_default_client_id , google_default_client_secret from gn args and GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET from your environment settings).
Getting Keys for Your Chromium Derivative
Many of the Google APIs used by Chrome are specific to Google and not intended for use in derived products. In the API Console you may be able to purchase additional quota for some of the APIs listed above. For APIs that do not have a "Pricing" link, additional quota is not available for purchase.
Polyfilling chrome.identity API in Your Chromium Derivative
The default Chromium chrome.identity.getAuthToken API that extensions may call to obtain auth tokens will fail outside of Google Chrome as the implementation uses restricted APIs.
A prototype CL for Chromium embedders might use to replace the implementation with one not dependent upon private APIs can be found attached to this post.
Документ показывает, что этот файл JSON содержит ключевую информацию.
Показан пример кода
Понятия не имею, как установить api-key. Он по-прежнему не работает после того, как я установил переменную среды для key и credentials .
Измените свой вопрос и укажите свой код. Ключ API предназначен для доступа к общедоступным API и не совпадает с учетными данными приложения.
Метод setApiKey в TranslateOptions является @Deprecated. Итак, как я могу заменить его своим собственным ключом из консоли GCP? @DalmTo
Предполагая, что вы нашли ключ API, попробуйте установить его в GOOGLE_API_KEY. Вы ищете открытый ключ API.
Я нашел ключ API в консоли, но не знаю, где установить GOOGLE_API_KEY.
это переменная среды, точно так же, как GOOGLE_APPLICATION_CREDENTIALS указывает на расположение json-файла учетной записи службы. GOOGLE_API_KEY вы устанавливаете в значение ключа
Я уже создал новую системную переменную GOOGLE_API_KEY, и ее значение представляет собой строку типа AIzaSyANUEzYsK*** . Но это не работает.
JavaScript (Js) - это язык программирования, объединяющий HTML и CSS с одной из основных технологий Всемирной паутины. Более 97% веб-сайтов используют.
Providing Keys at Runtime
If you prefer, you can build a Chromium binary (or use a pre-built Chromium binary) without API keys baked in, and instead provide them at runtime. To do so, set the environment variables GOOGLE_API_KEY , GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET to your "API key", "Client ID" and "Client secret" values respectively. On Chromium OS to specify the keys as environment variables append them to the end of /etc/chrome_dev.conf :
vusdo commented Jun 1, 2018
I am using Ubuntu 16.04.
export or /etc/chrome_dev.conf I tried both, but the existing key value
It is not replaced.I want to know how to replace api-key.
Getting Keys for Your Chromium Derivative
Many of the Google APIs used by Chrome are specific to Google and not intended for use in derived products. In the API Console (http://developers.google.com/console) you may be able to purchase additional quota for some of the APIs listed above. For APIs that do not have a "Pricing" link, additional quota is not available for purchase.
alswl commented Oct 14, 2019
@alswl: I'm not sure touching the bundle is better (never try nor want to) as it's will be overwritten in the next update/upgrade? How can it sustain upgrading Chromium in macOS?
As far as Chromium still honours environment variables, setting environment variables still works, I suppose.
Yes, it will be modified exactly if upgrade. All files in the Chrome.app is not stable if upgrade.
But there is better solution than modify launch entry point. Because there are many ways to launch the application, eg. multiple arguments.
Maybe your launch script should use $@ to propagate the arguments.hariskar commented May 8, 2021 •
I want to create OAuth client ID for Chromium on Android. What Application type should I choose when I create the OAuth client ID?
I chose "Web Application" and sync does not work. I have completed all previous steps.
Thank you for guide!htr3n commented Jul 5, 2019
the aforementioned method with launchctl setenv does not work under macOS Mojave (10.14) for me. Renaming binary Chromium and using special scripts to launch it still works, I suppose, but will be overwritten in the next Chromium upgrade? I have found some less intrusive ways that works in many macOS including Mojave. I noted them in this post.
gsitreble2019 commented Apr 4, 2021 •
These 3 links work for me! Only!
Thanks!In ubuntu edit file:
/etc/chromium-browser/default
Add lines:Now either restart laptop or ideally it should source automagically.
Can any bash expert tell me why it did not work for me if I use
ezeeyahoo commented Jan 17, 2018 •
Maxouhell commented Dec 4, 2017
Didn't work here.
I tried with MacOs and Windows 10.Chromium doesn't show Google API Keys are missing. Some functionality of Chromium will be disabled. anymore, but I have a SpeechRecognitionError with only network description.
It's working on Chrome, and i can't find out why.BasmaRG commented Feb 3, 2018
Thanks a lot, It is very useful.
Читайте также: