aws-amplify / aws-amplify/amplify-cli

Support for setting PreTokenGeneration to v2_0 for access token

Open
#13,682 2 comments 0 reactions 0 assignees View on GitHub
auth feature-request p4
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this feature request related to a new or existing Amplify category?

auth

### Is this related to another service?

cognito

### Describe the feature you'd like to request

Currently, the amplify cli doesn't support configuring the PreTokenGeneration trigger to v2_0 directly through its configuration

### Describe the solution you'd like

`amplify update auth`
`Do you want to enable any of the following capabilities?`
Add a `Override Access Token` option

### Describe alternatives you've considered

use `amplify override auth`
and in `override.ts`
```typescript
import {
AmplifyAuthCognitoStackTemplate,
AmplifyProjectInfo,
} from "@aws-amplify/cli-extensibility-helper";

export function override(
resources: AmplifyAuthCognitoStackTemplate,
amplifyProjectInfo: AmplifyProjectInfo
) {
resources.userPool.userPoolAddOns = {
AdvancedSecurityMode: "ENFORCED",
}; // This works if I just ignore the type error
resources.userPool.lambdaConfig = {
preTokenGenerationConfig: {
// ...
// This is not currently supported
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html#cfn-cognito-userpool-lambdaconfig-pretokengenerationconfig
LambdaVersion: "V2_0",
},
};
}
```

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

Start with the `amplify update auth` flow and the `AmplifyAuthCognitoStackTemplate` type used by `override.ts`; compare the requested `LambdaVersion: "V2_0"` setting with the linked CloudFormation property documentation. Done means the auth configuration exposes an `Override Access Token` option and generates the v2_0 PreTokenGeneration setting without requiring an override.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
authentication, cli, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.