GitHubContribute in GitHub: Edit online

copyright: years: 2018, 2023 lastupdated: "2023-01-07"


Authentication and connected services

You have several options for authenticating your connected services with Voice Gateway. Configure your services with basic authentication, by using a user name and password combination, or by using API key authentication.

Basic Authentication

Basic authentication, with a user name and password, is the default for Voice Gateway. You can define the user name and password in your deployment configuration files, or you can use token authentication.

By enabling token authentication for user name and password authentication, a token is retrieved the first time a lookup occurs with a specific set of service credentials. After the first lookup, the token is cached using a key that includes the user name and password combination. Any subsequent requests to that service using the same set of credentials will use the token to authenticate instead of the username and password.

API key authentication

Voice Gateway can connect to speech and data storage services, such as IBM Cloudant, by using API key authentication. When using API key authentication, Voice Gateway generates tokens to be used throughout multiple requests to improve latency and response time of the system. See Working with API keys for more information about using API keys with IBM Cloud services.

Tip: You can also use API key authentication when connecting to an IBM Cloudant service to publish reporting events. See Reporting events.

Configuring API key authentication with environment variables

In your docker deploy.yaml file, configure the following environment variables with your API key information and token service provider URL. See Configuration environment variables for Voice Gateway to learn more about available environment variables.

  • Watson Assistant:
WATSON_CONVERSATION_APIKEY=YOUR_API_KEY
  • Speech to Text:
WATSON_STT_APIKEY=YOUR_API_KEY
  • Text to Speech:
WATSON_TTS_APIKEY=YOUR_API_KEY

Using JSON configuration

The following code example shows a JSON file that contains the API key configurations for Watson Assistant, Speech to Text, and Text to Speech. See Advanced JSON configuration properties to learn more about different configuration options.

{

	"conversation": {
		"apikey": "YOUR_API_KEY"
	},
	"stt": {
		"credentials": {
			"apikey": "YOUR_API_KEY"
		}
	},
	"tts": {
		"credentials": {
			"apikey": "YOUR_API_KEY"
		}
	}
}