Skip to content

Conversation

@pranavosu
Copy link
Member

Description of changes

Adds Native Advanced Security Features (ASF) Context Data Support for React Native. This enables device fingerprinting data collection for Cognito's risk-based authentication on iOS and Android.

Changes:

  • New @aws-amplify/rtn-asf package with TurboModule implementation for iOS (Swift) and Android (Kotlin)
  • iOS native module using AWSCognitoIdentityProviderASF SDK
  • Android native module using aws-android-sdk-cognitoidentityprovider-asf SDK
  • Module loader in @aws-amplify/react-native with graceful degradation (returns undefined when not installed)
  • Updated getUserContextData.native.ts in @aws-amplify/auth to use the native module
  • UserContextData automatically included in signIn, signUp, and forgotPassword flows when available
  • README documentation with installation steps for bare React Native and Expo

Behavior:

  • When @aws-amplify/rtn-asf is installed: device context data is collected and sent to Cognito during auth flows
  • When not installed: auth flows continue normally without context data (graceful degradation)

Issue #, if available

Resolves false detections for legitimate React Native mobile users when Cognito Advanced Security Features are enabled.

Description of how you validated changes

  • Unit tests for module loader (loadAmplifyRtnAsf)
  • Unit tests for getUserContextData.native.ts
  • Property-based tests validating graceful degradation and output format transformation
  • iOS native unit tests (AmplifyRtnAsfTests.swift)
  • Android native unit tests (AmplifyRtnAsfModuleTest.kt)
  • Integration tests verifying UserContextData inclusion in auth flows

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pranavosu pranavosu changed the title feature feat: cognito asf for react native Dec 12, 2025
@pranavosu pranavosu marked this pull request as ready for review December 12, 2025 05:24
@pranavosu pranavosu requested review from a team, avi-karthik and sarayev as code owners December 12, 2025 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant