メインコンテンツまでスキップ

Tokens

トークンは、ブラウザセッションやサービス間通信での一時的なアクセス許可などの状況で使用されることを目的とした、短命でスコープが限定された値です。ユーザーログインのようなソフトウェアライフサイクルイベントでは、そのセッションの間だけ有効なトークンが発行されることがよくあります。これらのトークンはリフレッシュすることができません。セッションが継続する場合は、アプリケーションが新しいトークンを作成して発行する必要があります。

トークンはデータ操作のみへのアクセスを許可します。トークンは、キャッシュの作成、削除、フラッシュなどの制御プレーン操作や、他のトークンの作成はできません。

完全に特権化されたトークンを持つユーザーは、以下の操作を実行できます:

  • 任意のネームスペースでのキャッシュ・アイテムの追加/編集/削除
  • 任意のネームスペースでインクリメント API を使用したカウンタ値のインクリメント
  • 任意のネームスペースの任意のトピックの公開と購読

セキュリティ要件に基づいてトークンのアクセスを制限することは、ユーザーの裁量に任されています。

The token object

Attributes


is_success* boolean

Indicates whether the operation was successful.


type* enum

The type of the response, indicating the result of the operation.

Allowed values: Success, Error

authToken* string

An auth token that can be used to authenticate further requests. Typically a JWT or similar token.


endpoint* string

The endpoint URL that can be used for the returned token.


expiresAt* object

An object containing information about the expiration of the returned token.


The token object
{
"is_success": true,
"type": "Success",
"authToken": "eyJlbmRwb2ludCI6ImNlbGwtdXMt...",
"endpoint": "cell-us-east-1-1.prod.a.momentohq.com",
"expiresAt": {
"validUntil": 1724874811
}
}

Create a token

GenerateDisposableToken関数コールを使って新しいトークンを作成する。このトークンの有効期限は最大1時間で、更新することはできません。