Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.
DotNetBrowser is based on the Google Chromium engine. Some Chromium features use Google APIs. To access those APIs, an API Key is required. To acquire API Key follow the instruction.
You can provide the keys to DotNetBrowser Chromium engine:
Via environment variables
Set the Windows environment variablesGOOGLE_API_KEY
, GOOGLE_DEFAULT_CLIENT_ID
andGOOGLE_DEFAULT_CLIENT_SECRET
to your "API key", "Client ID" and "Client secret" values respectively. To find out where to get "API key", "Client ID" and "Client secret" see the video instruction.
Using the BrowserPreferences.SetChromiumVariable(String name, String value)
method
For example:
BrowserPreferences.SetChromiumVariable("GOOGLE_API_KEY", "Your API Key"); BrowserPreferences.SetChromiumVariable("GOOGLE_DEFAULT_CLIENT_ID", "Your Client ID"); BrowserPreferences.SetChromiumVariable("GOOGLE_DEFAULT_CLIENT_SECRET", "Your Client Secret");
You must configure Chromium variables before creating any
Browser
orBrowserView
instance.
If you are using aBrowserView
that is embedded into a Form or a Window, you need to configure these API keys beforeInitializeComponent()
call in the constructor.