Skip to main content

Installation & Setup

Installation

npm install react-native-credentials-manager

# or if you prefer yarn

yarn add react-native-credentials-manager

Android Setup

To implement the Credential Manager API in your Android application, follow these steps:

To enable passkey support, you need to associate your Android app with your website by creating and hosting a Digital Asset Links JSON file.

Create a file named assetlinks.json with the following content:

[
{
"relation": [
"delegate_permission/common.handle_all_urls",
"delegate_permission/common.get_login_creds"
],
"target": {
"namespace": "android_app",
"package_name": "your.package.name",
"sha256_cert_fingerprints": [
"YOUR_APP_SIGNING_CERTIFICATE_SHA256_FINGERPRINT"
]
}
}
]

Host this file at:

https://your-domain.com/.well-known/assetlinks.json

Important Requirements

  • The MIME type must be application/json
  • If you have a robots.txt, ensure it allows access to /.well-known/assetlinks.json:
    User-agent: *
    Allow: /.well-known/
  • The domain must be fully-qualified
  • Don't include trailing slashes or paths in the domain
  • Subdomains are not automatically included in the association

2. ProGuard Configuration

If you're using ProGuard in your Android application, add these rules to your android/app/proguard-rules.pro:

-if class androidx.credentials.CredentialManager
-keep class androidx.credentials.playservices.** {
*;
}

3. Google Sign-In Setup (Optional)

If you plan to use Google Sign-In:

  1. Configure your project in the Google Cloud Console
  2. Create OAuth 2.0 credentials
  3. Add your application's SHA-1 signing certificate fingerprint
  4. Note down your Web Client ID for use in the application

iOS Setup

note

iOS support using Authentication Services is coming soon.

Troubleshooting

Common Issues

  1. Digital Asset Links Not Working

    • Ensure your assetlinks.json file is accessible via HTTPS
    • Verify the SHA-256 fingerprint matches your app's signing certificate
    • Check that the package name matches your Android app exactly
  2. ProGuard Issues

    • Make sure the ProGuard rules are properly added
    • Clean and rebuild your project after adding the rules
  3. Build Errors

    • Ensure you're using a compatible React Native version
    • Clean the project and rebuild:
      cd android
      ./gradlew clean

For additional help, please check the GitHub issues or create a new issue if you encounter any problems.