# SignInPolicy

Sign-in policy for User Pools.

- Source: [`aws-cognito/lib/user-pool.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts#L495)
- Type last changed: v2.179.0 · 18 Feb 2025

## Example

TypeScript:

```ts
new cognito.UserPool(this, 'myuserpool', {
  signInPolicy: {
    allowedFirstAuthFactors: { password: true, passkey: true },
  },
  passkeyRelyingPartyId: 'auth.example.com',
  passkeyUserVerification: cognito.PasskeyUserVerification.REQUIRED,
});
```

Python:

```python
cognito.UserPool(self, "myuserpool",
    sign_in_policy=cognito.SignInPolicy(
        allowed_first_auth_factors=cognito.AllowedFirstAuthFactors(password=True, passkey=True)
    ),
    passkey_relying_party_id="auth.example.com",
    passkey_user_verification=cognito.PasskeyUserVerification.REQUIRED
)
```

Java:

```java
UserPool.Builder.create(this, "myuserpool")
        .signInPolicy(SignInPolicy.builder()
                .allowedFirstAuthFactors(AllowedFirstAuthFactors.builder().password(true).passkey(true).build())
                .build())
        .passkeyRelyingPartyId("auth.example.com")
        .passkeyUserVerification(PasskeyUserVerification.REQUIRED)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
new UserPool(this, "myuserpool", new UserPoolProps {
    SignInPolicy = new SignInPolicy {
        AllowedFirstAuthFactors = new AllowedFirstAuthFactors { Password = true, Passkey = true }
    },
    PasskeyRelyingPartyId = "auth.example.com",
    PasskeyUserVerification = PasskeyUserVerification.REQUIRED
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
cognito.NewUserPool(this, jsii.String("myuserpool"), &UserPoolProps{
	SignInPolicy: &SignInPolicy{
		AllowedFirstAuthFactors: &AllowedFirstAuthFactors{
			Password: jsii.Boolean(true),
			Passkey: jsii.Boolean(true),
		},
	},
	PasskeyRelyingPartyId: jsii.String("auth.example.com"),
	PasskeyUserVerification: cognito.PasskeyUserVerification_REQUIRED,
})
```

## Properties

- `allowedFirstAuthFactors`: [AllowedFirstAuthFactors](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.AllowedFirstAuthFactors.html) — The types of authentication that you want to allow for users' first authentication prompt.

  **Default:** Password only
