Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference@auth/dynamodb-adapter

@auth/dynamodb-adapter

Official DynamoDB adapter for Auth.js / NextAuth.js.

Installation

npm install next-auth @auth/dynamodb-adapter

DynamoDBAdapterOptions

Properties

indexName?

optional indexName: string;

indexPartitionKey?

optional indexPartitionKey: string;

indexSortKey?

optional indexSortKey: string;

partitionKey?

optional partitionKey: string;

sortKey?

optional sortKey: string;

tableName?

optional tableName: string;

format

const format: {
  from: null | T;
  to: Record<string, unknown>;
};

Type declaration

from()

Takes a Dynamo object and returns a plain old JavaScript object

Type parameters
Type parameterValue
TRecord<string, unknown>
Parameters
ParameterType
object?Record<string, any>
Returns

null | T

to()

Takes a plain old JavaScript object and turns it into a DynamoDB object

Parameters
ParameterType
objectRecord<string, any>
Returns

Record<string, unknown>


DynamoDBAdapter()

DynamoDBAdapter(client, options?): Adapter

Parameters

ParameterType
clientDynamoDBDocument
options?DynamoDBAdapterOptions

Returns

Adapter


generateUpdateExpression()

generateUpdateExpression(object): {
  ExpressionAttributeNames: Record<string, string>;
  ExpressionAttributeValues: Record<string, unknown>;
  UpdateExpression: string;
}

Parameters

ParameterType
objectRecord<string, any>

Returns

{
  ExpressionAttributeNames: Record<string, string>;
  ExpressionAttributeValues: Record<string, unknown>;
  UpdateExpression: string;
}

ExpressionAttributeNames

ExpressionAttributeNames: Record<string, string>;

ExpressionAttributeValues

ExpressionAttributeValues: Record<string, unknown>;

UpdateExpression

UpdateExpression: string;
Auth.js © Balázs Orbán and Team - 2024