Skip to content

Commit 50d1819

Browse files
committed
feat: update CredentialProvider mentions for api keys v2
1 parent 4e33f99 commit 50d1819

40 files changed

+335
-130
lines changed

docs/cache/develop/index.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,28 @@ Here is an example of how to construct a `CacheClient`:
2222

2323
## Instantiating credential providers using Momento API keys
2424

25-
You need to provide a Momento API key when instantiating a Momento client. If you don't have one yet, you can get one from the [Momento Web Console](https://console.gomomento.com/). 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:
25+
You need to provide a Momento API key when instantiating a Momento client. If you don't have one yet, you can get one from the [Momento Web Console](https://console.gomomento.com/).
2626

27-
<SdkExampleTabs snippetId={'API_CredentialProviderFromEnvVar'} />
27+
You also need to provide a Momento service endpoint. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
28+
29+
Once you have an API key and an endpoint, 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 the default environment variables `MOMENTO_API_KEY` and `MOMENTO_ENDPOINT`:
30+
31+
<SdkExampleTabs snippetId={'API_CredentialProviderFromEnvVarV2Default'} />
32+
33+
Alternately provide custom environment variable names:
34+
35+
<SdkExampleTabs snippetId={'API_CredentialProviderFromEnvVarV2'} />
2836

2937
If you're storing your Momento auth token in a secret manager such as [AWS Secret Manager](https://aws.amazon.com/secrets-manager/), [GCP Secret Manager](https://cloud.google.com/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:
3038

31-
<SdkExampleTabs snippetId={'API_CredentialProviderFromString'} />
39+
<SdkExampleTabs snippetId={'API_CredentialProviderFromApiKeyV2'} />
3240

3341
For an example of how to retrieve credentials from AWS Secrets Manager, see [Retrieving a Momento auth token from AWS Secrets Manager](/cache/integrations/aws-secrets-manager).
3442

43+
If you have a disposable auth token or a v1 API key, you can instantiate a `CredentialProvider` like this:
44+
45+
<SdkExampleTabs snippetId={'API_CredentialProviderFromDisposableToken'} />
46+
3547
For general information on Momento authentication, see [our auth page](../authentication/index.mdx).
3648

3749
For more information, see our [Response Objects](./develop/api-reference/response-objects) page, and the docs for the specific SDK that you are using (under `Develop`->`SDKs` in the left nav).

docs/leaderboards/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ Then follow our [step-by-step instructions](https://docs.momentohq.com/cache/aut
5252
// as many leaderboards as you wish
5353
const client = new PreviewLeaderboardClient({
5454
configuration: LeaderboardConfigurations.Laptop.v1(),
55-
credentialProvider: CredentialProvider.fromEnvironmentVariable({
56-
environmentVariableName: 'MOMENTO_API_KEY',
57-
}),
5855
});
5956

6057
// Create a new leaderboard with the given cache and leaderboard name

docs/platform/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ keywords:
1919

2020
# The Momento Platform
2121

22-
Ship better products, faster with a platform designed for mission-critical workloads. Momento makes infrastructure easy at enterprise scale with [caching](/cache), [unrivaled event messaging](/topics), and soon, *storage*!
22+
Ship better products, faster with a platform designed for mission-critical workloads. Momento makes infrastructure easy at enterprise scale with [caching](/cache) and [unrivaled event messaging](/topics)!
2323

2424
import { CardGrid } from '@site/src/components/CardGrid';
2525
import { LinkCard } from '@site/src/components/LinkCard';

docs/platform/sdks/dart/cache.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ export MOMENTO_API_KEY=<your api key here>
6464

6565
**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes.
6666

67+
## Get your Momento service endpoint
68+
69+
You'll also need a Momento service endpoint. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
70+
Once you have selected an endpoint, store it in an environment variable so that the Momento client can consume it:
71+
72+
```
73+
export MOMENTO_ENDPOINT=<your service endpoint here>
74+
```
75+
6776
## Set up a CacheClient
6877
This code creates the CacheClient that you will use to call the other methods.
6978

docs/platform/sdks/dart/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Dart packages are published to [pub.dev as `momento`](https://pub.dev/packages/m
4343

4444
- [Dart version 3](https://dart.dev/get-dart) or higher is required.
4545
- A Momento API key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/).
46+
- A Momento service endpoint is required. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
4647

4748
## Resources
4849

docs/platform/sdks/dart/topics.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ export MOMENTO_API_KEY=<your api key here>
6565

6666
**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes.
6767

68+
## Get your Momento service endpoint
69+
70+
You'll also need a Momento service endpoint. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
71+
Once you have selected an endpoint, store it in an environment variable so that the Momento client can consume it:
72+
73+
```
74+
export MOMENTO_ENDPOINT=<your service endpoint here>
75+
```
76+
6877
## Set up a TopicClient
6978
This code creates the TopicClient that you will use to interact with your pub/sub topic.
7079

docs/platform/sdks/dotnet/cache.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ export MOMENTO_API_KEY=<your Momento API key here>
5555

5656
**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes.
5757

58+
## Set up your Momento service endpoint
59+
60+
You'll also need a Momento service endpoint. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
61+
Once you have selected an endpoint, store it in an environment variable so that the Momento client can consume it:
62+
63+
```
64+
export MOMENTO_ENDPOINT=<your service endpoint here>
65+
```
66+
5867
## Import libraries and create a CacheClient object
5968
[This example file](https://github.com/momentohq/client-sdk-dotnet/blob/main/examples/MomentoUsage/Program.cs) pulls in the necessary imports, reads the API key from an environment variable, and instantiates the CacheClient that is used to interact with a cache.
6069

docs/platform/sdks/dotnet/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The source code can be found on GitHub: [momentohq/client-sdk-dotnet](https://gi
3939

4040
- [`dotnet` runtime and command line tools](https://dotnet.microsoft.com/en-us/download); after installing them, you should have the `dotnet` command on your PATH.
4141
- A Momento API Key is required; you can get one from the [Momento Web Console](https://console.gomomento.com/).
42+
- A Momento service endpoint is required. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
4243
- You will most likely want an IDE that supports .NET development, such as [Microsoft Visual Studio](https://visualstudio.microsoft.com/vs), [JetBrains Rider](https://www.jetbrains.com/rider/), or [Microsoft Visual Studio Code](https://code.visualstudio.com/).
4344

4445
## Resources

docs/platform/sdks/dotnet/topics.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ export MOMENTO_API_KEY=<your api key here>
5555

5656
**Note**: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced security, but we are using one here for demo purposes.
5757

58+
## Get your Momento service endpoint
59+
60+
You'll also need a Momento service endpoint. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
61+
Once you have selected an endpoint, store it in an environment variable so that the Momento client can consume it:
62+
63+
```
64+
export MOMENTO_ENDPOINT=<your service endpoint here>
65+
```
66+
5867
## Set up a TopicClient
5968
This code creates the TopicClient that you will use to interact with your pub/sub topic.
6069

docs/platform/sdks/elixir/cache.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ Once you have your token, store it in an environment variable so that the Moment
4949
export MOMENTO_API_KEY=<your Momento token here>
5050
```
5151

52+
## Set up your Momento service endpoint
53+
54+
You'll also need a Momento service endpoint. You can find a [list of them here](https://docs.momentohq.com/platform/regions).
55+
Once you have selected an endpoint, store it in an environment variable so that the Momento client can consume it:
56+
57+
```
58+
export MOMENTO_ENDPOINT=<your service endpoint here>
59+
```
60+
5261
## Set up a CacheClient
5362
This code creates the CacheClient struct that each of the other functions requires.
5463

0 commit comments

Comments
 (0)