Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2.9 #44

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ features for the product-led era.
- [Wrap your app with FronteggProvider](#wrap-your-app-with-fronteggprovider)
- [Login with frontegg](#login-with-frontegg)
- [Check if user is authenticated](#check-if-user-is-authenticated)
- [Passkeys Authentication](#passkeys-authentication)

## Project Requirements

Expand Down Expand Up @@ -530,3 +531,105 @@ export default function HomeScreen() {
</View>
}
```

## Passkeys Authentication

Passkeys provide a seamless, passwordless authentication experience, leveraging platform-level biometric authentication and WebAuthn. Follow the steps below to integrate passkeys functionality into your iOS app.

### Prerequisites

1. **iOS Version**: Ensure your project targets **iOS 15 or later** to support the necessary WebAuthn APIs.
3. **Android**: Use **Android SDK 26+**.
5. **Frontegg SDK Version**: Use Frontegg iOS SDK version **1.2.24 or later**.

---

## Setup

### Android Setup

1. **Update Gradle Dependencies**:
Add the following dependencies in your `android/build.gradle`:
```groovy
dependencies {
implementation 'androidx.browser:browser:1.8.0'
implementation 'com.frontegg.sdk:android:1.2.30'
}
```

2. **Java Compatibility**:
Ensure sourceCompatibility and targetCompatibility are set to Java 8 in android/app/build.gradle**:
```groovy
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
```

### IOS Setup

1. **Set up the Associated Domains Capability**:
- Open your project in Xcode.
- Go to the **Signing & Capabilities** tab.
- Add **Associated Domains** under the **+ Capability** section.
- Enter the domain for your app in the format:
```
webcredentials:[YOUR_DOMAIN]
```
Example:
```
webcredentials:example.com
```

2. **Host the WebAuthn Configuration File**:
- Add a `.well-known/webauthn` JSON file to your domain server with the following structure:
```json
{
"origins": [
"https://example.com",
"https://subdomain.example.com"
]
}
```
- Ensure this file is publicly accessible at `https://example.com/.well-known/webauthn`.

3. **Test Associated Domains**:
- Verify that your associated domain configuration works using Apple's [Associated Domains Validator](https://developer.apple.com/contact/request/associated-domains).


### Using Passkeys
The following examples demonstrate how to use the React Native SDK's Passkeys functions.

### Registering Passkeys
Use the registerPasskeys method to register a passkey for the current user.

```typescript
import { registerPasskeys } from '@frontegg/react-native';

async function handleRegisterPasskeys() {
try {
await registerPasskeys();
console.log('Passkeys registered successfully');
} catch (error) {
console.error('Error registering passkeys:', error);
}
}
```

### Login with Passkeys
Use the loginWithPasskeys method to authenticate users using passkeys.

```typescript
import { loginWithPasskeys } from '@frontegg/react-native';

async function handleLoginWithPasskeys() {
try {
await loginWithPasskeys();
console.log('Passkeys login successful');
} catch (error) {
console.error('Error logging in with Passkeys:', error);
}
}
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@frontegg/react-native",
"version": "1.2.8",
"version": "1.2.9",
"description": "Frontegg React-Native SDK",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down