View source: R/ms_authorization.R
ms_fetch_key | R Documentation |
Determines if option(ms_tts_key)
is set or key is stored in an
environment variable (MS_TTS_API_KEY, MS_TTS_API_KEY1, MS_TTS_API_KEY2). If
not found, stops and returns an error. If found, returns the value.
ms_fetch_key(api_key = NULL, error = TRUE)
ms_exist_key(api_key = NULL)
ms_set_key(api_key)
ms_valid_key(api_key = NULL, region = "westus")
api_key |
Microsoft Cognitive Services API key |
error |
Should the function error if |
region |
Subscription region for API key. For more info, see https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/regions |
API key
Logical vector, indicating whether user has API key.
Logical vector, indicating whether API key is valid.
ms_exist_key()
: Does user have API key?
ms_set_key()
: Set API Key as a global option
ms_valid_key()
: Check whether API key is valid
You can either set the API key using option(ms_tts_key)
or have
it accessible by api_key = Sys.getenv('MS_TTS_API_KEY")}, or
\code{api_key = Sys.getenv('MS_TTS_API_KEY1")}, or \code{api_key =
Sys.getenv('MS_TTS_API_KEY2")
res = ms_fetch_key(api_key = NULL, error = FALSE)
# Don't provide api key but fetch it programmatically
ms_exist_key(api_key = NULL)
# Provide api key XXX
ms_exist_key(api_key = "XXX")
# Set api key XXX
ms_set_key(api_key = "XXX")
# Check whether API key is valid in westus
ms_valid_key(region = "westus")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.