Developing applications with Momento SDKs
Welcome! This page provides information about common constructs you will need in order to assemble Momento clients in all of our SDKs. This page covers how to provide your Momento credentials (called api keys), how to configure your client, and some basic information about error handling and production readiness.
Constructing a Preview Momento Vector Index client
Work in progress.
Instantiating credential providers using Momento api keys
You need to provide a Momento auth token when instantiating a Momento client. If you don't have one yet, you can get one from the Momento Web Console. Once you have a token, provide it to Momento SDKs when you create an instance of
CredentialProvider. There are convenient factory methods provided to construct a
CredentialProvider object, either from an environment variable or from a String. Below is an example of how to instantiate
CredentialProvider from an environment variable:
If you're storing your Momento auth token in a secret manager such as AWS Secret Manager, GCP Secret Manager, or a local config file, you must first retrieve the credentials from there and then instantiate a
CredentialProvider from a string, like this:
const apiKey = retrieveApiKeyFromYourSecretsManager();
final String authToken = retrieveAuthTokenFromYourSecretsManager();
auth_token = retrieve_auth_token_from_your_secrets_manager()