Skip to content

Commit

Permalink
fix: convert remaining occurrences of MOMENTO_AUTH_TOKEN to MOMENTO_A…
Browse files Browse the repository at this point in the history
…PI_KEY
  • Loading branch information
cprice404 committed Aug 2, 2024
1 parent 5195b8d commit e7e366e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/cache/integrations/unity-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The MessagingCanvas also has several additional features to complete the Unity m
- an image button in the bottom-right that utilizes the third-party [UnityStandaloneFileBrowser](https://github.com/gkngkc/UnityStandaloneFileBrowser) to allow the user to load images from their computer to send in a chat message

### Example Scenes
In the example code, we provide four example Unity scenes, showcasing various ways to integrate the Momento SDK with Unity. The first two require ensuring the `MOMENTO_AUTH_TOKEN` environment variable is set, or copying and pasting your auth token into `Assets/Scripts/TopicsTest.cs` (or `Assets/Scripts/TopicsTestCoroutine.cs`) replacing `ADD_YOUR_TOKEN_HERE` in the `ReadAuthToken()` function (hard-coding your auth token in code is not recommended but can be used for testing purposes if necessary).
In the example code, we provide four example Unity scenes, showcasing various ways to integrate the Momento SDK with Unity. The first two require ensuring the `MOMENTO_API_KEY` environment variable is set, or copying and pasting your auth token into `Assets/Scripts/TopicsTest.cs` (or `Assets/Scripts/TopicsTestCoroutine.cs`) replacing `ADD_YOUR_TOKEN_HERE` in the `ReadAuthToken()` function (hard-coding your auth token in code is not recommended but can be used for testing purposes if necessary).
- `MomentoTopicsDemo.unity` (using `TopicsTest.cs`): utilizes `Task.Run()` to run the subscription to the Momento Topic in a background thread. This is the approach descirbed above. This code is based upon the [Momento .NET SDK Topic Example](https://github.com/momentohq/client-sdk-dotnet/tree/main/examples/TopicExample).
- `MomentoTopicsDemo-Coroutine.unity` (using `TopicsTestCoroutine.cs`): identical to the previous scene except that it utilizes Unity Coroutines to run the subscription asyncronously in the main thread.
- `MomentoTopicsDemo-TokenVendingMachine.unity` (using `TopicsTestTokenVendingMachine.cs`): utilizes the example [Momento Token Vending Machine](https://github.com/momentohq/client-sdk-javascript/tree/main/examples/nodejs/token-vending-machine) to obtain a temporary, restricted scope Momento auth token. This is beneficial because (1) we no longer need to hard-code in a specific auth token into the app, and (2) we can utilize a `tokenId` embedded in the Topics message to more securely know which client/username sent a specific message. Note that you'll need to explicitly setup the Token Vending Machine separately and then specify its URL via the `tokenVendingMachineURL` variable specified in `TopicsTestTokenVendingMachine.cs`.
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/elixir/cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You'll need a Momento auth token to authenticate with Momento. You can get one
Once you have your token, store it in an environment variable so that the Momento client can consume it:

```
export MOMENTO_AUTH_TOKEN=<your Momento token here>
export MOMENTO_API_KEY=<your Momento token here>
```

## Set up a CacheClient
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/go/cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You'll need a [Momento API key](/cache/develop/authentication/api-keys.md) to au
Once you have your token, store it in an environment variable so that the Momento client can consume it:

```
export MOMENTO_AUTH_TOKEN=<your Momento token here>
export MOMENTO_API_KEY=<your Momento token here>
```

**Note**: it is best practice to put the token 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.
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/nodejs/topics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ You'll need a [Momento API key](/cache/develop/authentication/api-keys) to authe
Once you have a token, store it in an environment variable so that the Momento client can consume it:

```
export MOMENTO_AUTH_TOKEN=<your Momento token here>
export MOMENTO_API_KEY=<your Momento token here>
```

**Note**: it is best practice to put the token 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.
Expand Down
4 changes: 2 additions & 2 deletions docs/sdks/python/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ from momento.responses import CacheGet, CacheSet, CreateCache, ListCaches, Cache
import os

def create_client():
momento_auth_token = CredentialProvider.from_environment_variable('MOMENTO_API_KEY')
momento_api_key = CredentialProvider.from_environment_variable('MOMENTO_API_KEY')
ttl = timedelta(seconds=int(os.getenv('MOMENTO_TTL_SECONDS', '600')))
config = {
'configuration': Configurations.Laptop.v1(),
'credential_provider': momento_auth_token,
'credential_provider': momento_api_key,
'default_ttl': ttl
}
return CacheClient.create(**config)
Expand Down

0 comments on commit e7e366e

Please sign in to comment.