API Reference
    Preparing search index...

    Variable PreTokenGenerationTriggerSchemaV2AndV3Const

    PreTokenGenerationTriggerSchemaV2AndV3: ZodObject<
        extendShape<
            {
                callerContext: ZodObject<
                    { awsSdkVersion: ZodString; clientId: ZodString },
                    "strip",
                    ZodTypeAny,
                    { awsSdkVersion: string; clientId: string },
                    { awsSdkVersion: string; clientId: string },
                >;
                region: ZodString;
                request: ZodObject<{}, "strip", ZodTypeAny, {}, {}>;
                response: ZodObject<{}, "strip", ZodTypeAny, {}, {}>;
                triggerSource: ZodString;
                userName: ZodOptional<ZodString>;
                userPoolId: ZodString;
                version: ZodString;
            },
            {
                request: ZodObject<
                    extendShape<
                        {
                            clientMetadata: ZodOptional<ZodRecord<ZodString, ZodString>>;
                            groupConfiguration: ZodObject<
                                {
                                    groupsToOverride: ZodArray<ZodString, "many">;
                                    iamRolesToOverride: ZodArray<ZodString, "many">;
                                    preferredRole: ZodOptional<ZodString>;
                                },
                                "strip",
                                ZodTypeAny,
                                {
                                    groupsToOverride: string[];
                                    iamRolesToOverride: string[];
                                    preferredRole?: string;
                                },
                                {
                                    groupsToOverride: string[];
                                    iamRolesToOverride: string[];
                                    preferredRole?: string;
                                },
                            >;
                            userAttributes: ZodRecord<ZodString, ZodString>;
                        },
                        { scopes: ZodOptional<ZodArray<ZodString, "many">> },
                    >,
                    "strip",
                    ZodTypeAny,
                    {
                        clientMetadata?: Record<string, string>;
                        groupConfiguration: {
                            groupsToOverride: string[];
                            iamRolesToOverride: string[];
                            preferredRole?: string;
                        };
                        scopes?: string[];
                        userAttributes: Record<string, string>;
                    },
                    {
                        clientMetadata?: Record<string, string>;
                        groupConfiguration: {
                            groupsToOverride: string[];
                            iamRolesToOverride: string[];
                            preferredRole?: string;
                        };
                        scopes?: string[];
                        userAttributes: Record<string, string>;
                    },
                >;
            },
        >,
        "strip",
        ZodTypeAny,
        {
            callerContext: { awsSdkVersion: string; clientId: string };
            region: string;
            request: {
                clientMetadata?: Record<string, string>;
                groupConfiguration: {
                    groupsToOverride: string[];
                    iamRolesToOverride: string[];
                    preferredRole?: string;
                };
                scopes?: string[];
                userAttributes: Record<string, string>;
            };
            response: {};
            triggerSource: string;
            userName?: string;
            userPoolId: string;
            version: string;
        },
        {
            callerContext: { awsSdkVersion: string; clientId: string };
            region: string;
            request: {
                clientMetadata?: Record<string, string>;
                groupConfiguration: {
                    groupsToOverride: string[];
                    iamRolesToOverride: string[];
                    preferredRole?: string;
                };
                scopes?: string[];
                userAttributes: Record<string, string>;
            };
            response: {};
            triggerSource: string;
            userName?: string;
            userPoolId: string;
            version: string;
        },
    > = ...

    A zod schema for a Cognito Pre-Token Generation trigger event (version 2 and 3).

    {
    "version": "2",
    "triggerSource": "TokenGeneration_Authentication",
    "region": "us-east-1",
    "userPoolId": "us-east-1_ABC123",
    "userName": "johndoe",
    "callerContext": {
    "awsSdkVersion": "2.814.0",
    "clientId": "client123"
    },
    "request": {
    "userAttributes": { "string": "string" },
    "groupConfiguration": {
    "groupsToOverride": [ "string", "string" ],
    "iamRolesToOverride": [ "string", "string" ],
    "preferredRole": "string"
    },
    "scopes": [ "string", "string" ],
    "clientMetadata": { "string": "string" }
    },
    "response": {}
    }