Skip to content

Commit 5167fbb

Browse files
authored
Restore lost info from pre-IA (#2740)
1 parent b478492 commit 5167fbb

File tree

6 files changed

+295
-3
lines changed

6 files changed

+295
-3
lines changed

docs/guides/configure/auth-strategies/sign-up-sign-in-options.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ A passkey is a type of sign-in credential that requires one user action, but use
7676

7777
**Users can only create passkeys after signing up**, so you'll need to enable another authentication strategy for the sign-up process. After signing in, users can create a passkey.
7878

79+
<If sdk="android">
80+
When setting up passkeys with Android, there are a few additional steps to follow. [Learn more about passkeys for Android](/docs/reference/android/passkeys).
81+
</If>
82+
83+
<If sdk="expo">
84+
When setting up passkeys with Expo, there are a few additional steps to follow. [Learn more about passkeys for Expo](/docs/reference/expo/passkeys).
85+
</If>
86+
7987
#### Passkey limitations
8088

8189
- Passkeys are not currently available as an [MFA](#multi-factor-authentication) option.

docs/guides/development/custom-flows/authentication/passkeys.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ This guide demonstrates how to use the Clerk API to build a custom user interfac
1111

1212
## Enable passkeys
1313

14-
To use passkeys, you must first enable it for your application.
14+
To use passkeys, first enable the strategy in the [Clerk Dashboard](https://dashboard.clerk.com/~/user-authentication/user-and-authentication?user_auth_tab=passkeys).
1515

16-
1. In the Clerk Dashboard, navigate to the [**User & authentication**](https://dashboard.clerk.com/~/user-authentication/user-and-authentication) page.
17-
1. Select the **Passkeys** tab and enable **Sign-in with passkey**.
16+
<If sdk="android">
17+
When setting up passkeys with Android, there are a few additional steps to follow. [Learn more about passkeys for Android](/docs/reference/android/passkeys).
18+
</If>
19+
20+
<If sdk="expo">
21+
When setting up passkeys with Expo, there are a few additional steps to follow. [Learn more about passkeys for Expo](/docs/reference/expo/passkeys).
22+
</If>
1823

1924
### Domain restrictions for passkeys
2025

docs/manifest.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,10 @@
15771577
{
15781578
"title": "`useSSO()`",
15791579
"href": "/docs/reference/expo/use-sso"
1580+
},
1581+
{
1582+
"title": "Configure passkeys",
1583+
"href": "/docs/reference/expo/passkeys"
15801584
}
15811585
]
15821586
]
@@ -1925,6 +1929,14 @@
19251929
{
19261930
"title": "Overview",
19271931
"href": "/docs/reference/android/overview"
1932+
},
1933+
{
1934+
"title": "`getToken()`",
1935+
"href": "/docs/reference/android/get-token"
1936+
},
1937+
{
1938+
"title": "Configure passkeys",
1939+
"href": "/docs/reference/android/passkeys"
19281940
}
19291941
]
19301942
]
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: '`getToken()`'
3+
description: Use Clerk's Android SDK to retrieve a token for a JWT template that is defined in the Clerk Dashboard.
4+
sdk: android
5+
---
6+
7+
The `getToken()` method retrieves the user's [session token](/docs/guides/sessions/session-tokens) or a [custom JWT template](/docs/guides/sessions/jwt-templates).
8+
9+
This method uses a cache so a network request will only be made if the token in memory has expired. The TTL for a Clerk token is one minute.
10+
11+
Tokens can only be generated if the user is signed in.
12+
13+
```kotlin {{ filename: 'Session.kt' }}
14+
suspend fun Session.fetchToken(
15+
options: SessionGetTokenOptions = SessionGetTokenOptions()
16+
): TokenResource? {
17+
return SessionTokenFetcher().getToken(this, options)
18+
}
19+
```
20+
21+
## Parameters
22+
23+
<Properties>
24+
- `options`
25+
- [`GetTokenOptions`](#get-token-options)
26+
27+
Options that can be passed as parameters to the `getToken()` function.
28+
</Properties>
29+
30+
### `GetTokenOptions`
31+
32+
<Properties>
33+
- `template`
34+
- `String?`
35+
36+
The name of the JWT template from the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=jwt-templates) to generate a new token from. For example: 'firebase', 'grafbase', or your custom template's name.
37+
38+
---
39+
40+
- `expirationBuffer`
41+
- `Long`
42+
43+
If the cached token will expire within `{expirationBuffer}` seconds, fetch a new token instead. Max is 60 seconds. Defaults to 10 seconds.
44+
45+
---
46+
47+
- `skipCache`
48+
- `Boolean`
49+
50+
Whether to skip the cache lookup and force a refresh of the token instead. Useful if the token claims are time-sensitive or depend on data that can be updated (e.g. user fields). Defaults to false.
51+
</Properties>
52+
53+
## Example
54+
55+
```kotlin
56+
val session = Clerk.session
57+
58+
scope.launch {
59+
val token = session?.fetchToken()?.onSuccess { tokenResource ->
60+
headers["Authorization"] = "Bearer ${tokenResource.jwt}"
61+
}
62+
}
63+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Configure passkeys for Android
3+
description: Learn how to configure passkeys for your Android application.
4+
sdk: android
5+
---
6+
7+
[Passkeys](/docs/guides/configure/auth-strategies/sign-up-sign-in-options#passkeys) are a secure, passwordless authentication method that use biometrics and a physical device to authenticate users. This guide shows you how to configure passkeys for your Android application.
8+
9+
> [!WARNING]
10+
> Android supports passkeys from version 9+. Passkeys will not work with Android emulators. You must use a physical device.
11+
12+
<Steps>
13+
## Enable passkeys
14+
15+
To use passkeys, first enable the strategy in the [Clerk Dashboard](https://dashboard.clerk.com/~/user-authentication/user-and-authentication?user_auth_tab=passkeys).
16+
17+
## Set up your Android app links in the Clerk Dashboard
18+
19+
1. In the Clerk Dashboard, navigate to the [**Native Applications**](https://dashboard.clerk.com/last-active?path=user-authentication/native-applications) page.
20+
1. Select the **Android** tab.
21+
1. Select **Add Android app**.
22+
1. Fill out the form with the following information:
23+
- The `namespace` (This guide uses the default value `android_app`)
24+
- Your Android app's package name. You can find this in your app-level `build.gradle` file, typically formatted like `com.example.myclerkapp`.
25+
- The `SHA256 certificate fingerprints`. If you don't know where to find the `SHA256 certificate fingerprints`, see the [Android docs](https://developers.google.com/android/guides/client-auth).
26+
1. After submitting the form, you can verify that your `assetlinks.json` file is properly associated with your app by using [Google's **Statement List Generator and Tester**](https://developers.google.com/digital-asset-links/tools/generator).
27+
</Steps>
28+
29+
## Usage
30+
31+
To learn how to use passkeys in your Android application, such as creating, deleting, and authenticating users with passkeys, see the [custom flow guide](/docs/guides/development/custom-flows/authentication/passkeys).

docs/reference/expo/passkeys.mdx

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
title: Configure passkeys for Expo
3+
description: Learn how to configure passkeys for your Expo application.
4+
sdk: expo
5+
---
6+
7+
[Passkeys](/docs/guides/configure/auth-strategies/sign-up-sign-in-options#passkeys) are a secure, passwordless authentication method that use biometrics and a physical device to authenticate users. This guide shows you how to configure passkeys for your Expo application.
8+
9+
> [!WARNING]
10+
> This API is available only for [`@clerk/clerk-expo >=2.2.0`](/docs/guides/development/upgrading/upgrade-guides/expo-v2).
11+
12+
<Steps>
13+
## Enable passkeys
14+
15+
To use passkeys, first enable the strategy in the [Clerk Dashboard](https://dashboard.clerk.com/~/user-authentication/user-and-authentication?user_auth_tab=passkeys).
16+
17+
## Configure passkeys
18+
19+
Use the following tabs to configure your passkeys for `iOS` or `Android`.
20+
21+
<Tabs items={['iOS', 'Android']}>
22+
<Tab>
23+
> [!WARNING]
24+
> iOS supports passkeys from version iOS 16+
25+
>
26+
> This library includes native code and will not work when running Expo Go. Instead, use a development build by running `npx expo run:ios`.
27+
28+
### Get your App ID Prefix and Bundle ID from Apple
29+
30+
To get your **App ID Prefix** and **Bundle ID**, follow these steps:
31+
32+
1. Navigate to the [Apple Developer dashboard](https://developer.apple.com/account).
33+
1. Under **Certificates, IDs and Profiles**, select [**Identifiers**](https://developer.apple.com/account/resources/identifiers/list).
34+
1. In the top-right, select the dropdown and select **App IDs**.
35+
1. Select the **App ID** you want to configure passkeys for. You'll be redirect to the **Review your App ID Configuration** page.
36+
1. At the top of the page, you'll see your **App ID Prefix** and **Bundle ID**. Save these values somewhere secure.
37+
38+
### Set up your associated domain file in the Clerk Dashboard
39+
40+
1. In the Clerk Dashboard, navigate to the [**Native Applications**](https://dashboard.clerk.com/last-active?path=user-authentication/native-applications) page.
41+
1. Select the **iOS** tab.
42+
1. Select **Add iOS App**.
43+
1. Paste the **App ID Prefix** and **Bundle ID** that you copied in the previous step.
44+
1. Select **Add App**.
45+
1. On the right-side, save your **Frontend API URL** somewhere secure.
46+
47+
### Update `app.json` in your Expo app
48+
49+
1. In your app's `app.json` file, under the `ios` object, add the `associatedDomains` property as shown in the following example. Replace `<YOUR_FRONTEND_API_URL>` with the **Frontend API URL** value that you saved in the previous step.
50+
51+
```json {{ filename: 'app.json', mark: [[5, 12], [14, 20]] }}
52+
{
53+
"expo": {
54+
//...existing properties
55+
"plugins": [
56+
[
57+
"expo-build-properties",
58+
{
59+
"ios": {
60+
"deploymentTarget": "16.0" // iOS Support passkeys from version iOS 16+
61+
}
62+
}
63+
]
64+
],
65+
"ios": {
66+
//...existing properties
67+
"associatedDomains": [
68+
"applinks:<YOUR_FRONTEND_API_URL>",
69+
"webcredentials:<YOUR_FRONTEND_API_URL>"
70+
]
71+
}
72+
}
73+
}
74+
```
75+
</Tab>
76+
77+
<Tab>
78+
> [!WARNING]
79+
> Android supports passkeys from version 9+. Passkeys will not work with Android emulators. You must use a physical device.
80+
>
81+
> This library includes native code and [will not work when running Expo Go](https://docs.expo.dev/workflow/customizing/#using-libraries-that-include-native-code). Instead, use a development build by running `npx expo run:android`.
82+
83+
### Set up your Android app links in the Clerk Dashboard
84+
85+
1. In the Clerk Dashboard, navigate to the [**Native Applications**](https://dashboard.clerk.com/last-active?path=user-authentication/native-applications) page.
86+
1. Select the **Android** tab.
87+
1. Select **Add Android app**.
88+
1. Fill out the form with the following information:
89+
- The `namespace` (This guide uses the default value: `android_app`)
90+
- Your Android app's package name
91+
- The `SHA256 certificate fingerprints`. If you don't know where to find the `SHA256 certificate fingerprints`, see the [Expo docs](https://docs.expo.dev/linking/android-app-links/#create-assetlinksjson-file).
92+
1. After submitting the form, you can verify that your `assetlinks.json` file is properly associated with your app by using [Google's **Statement List Generator and Tester**](https://developers.google.com/digital-asset-links/tools/generator).
93+
1. On the right-side, save your **Frontend API URL** somewhere secure.
94+
95+
### Install `expo-build-properties` in your Expo application
96+
97+
```npm
98+
npm install expo-build-properties
99+
```
100+
101+
### Update `app.json` in your Expo application
102+
103+
1. In your app's `app.json` file, under `android`, add the `intentFilters` property as shown in the following example. Replace `<YOUR_FRONTEND_API_URL>` with the **Frontend API URL** value that you saved in the previous step.
104+
105+
```json {{ filename: 'app.json', mark: [[3, 6], [10, 22]] }}
106+
{
107+
"expo": {
108+
"plugins": [["expo-build-properties"]],
109+
"android": {
110+
//...existing properties
111+
"intentFilters": [
112+
{
113+
"action": "VIEW",
114+
"autoVerify": true,
115+
"data": [
116+
{
117+
"scheme": "https",
118+
"host": "<YOUR_FRONTEND_API_URL>"
119+
}
120+
],
121+
"category": ["BROWSABLE", "DEFAULT"]
122+
}
123+
]
124+
}
125+
}
126+
}
127+
```
128+
</Tab>
129+
</Tabs>
130+
131+
## Install `@clerk/expo-passkeys`
132+
133+
Run the following command to install the `@clerk/expo-passkeys` package:
134+
135+
```npm
136+
npm install @clerk/expo-passkeys
137+
```
138+
139+
## Prebuild Expo project
140+
141+
Run the following command to prebuild your Expo project:
142+
143+
```bash {{ filename: 'terminal' }}
144+
npx expo prebuild
145+
```
146+
147+
## Update your `<ClerkProvider>`
148+
149+
Pass the `passkeys` object to the `__experimental_passkeys` property of your `<ClerkProvider>` component, as shown in the following example:
150+
151+
```tsx {{ filename: 'app/_layout.tsx', mark: [4, 11] }}
152+
import { ClerkProvider } from '@clerk/clerk-expo'
153+
import { Slot } from 'expo-router'
154+
import { tokenCache } from '@clerk/clerk-expo/token-cache'
155+
import { passkeys } from '@clerk/clerk-expo/passkeys'
156+
157+
export default function RootLayout() {
158+
return (
159+
<ClerkProvider
160+
tokenCache={tokenCache}
161+
publishableKey={publishableKey}
162+
__experimental_passkeys={passkeys}
163+
>
164+
<Slot />
165+
</ClerkProvider>
166+
)
167+
}
168+
```
169+
</Steps>
170+
171+
## Usage
172+
173+
To learn how to use passkeys in your Expo application, such as creating, deleting, and authenticating users with passkeys, see the [custom flow guide](/docs/guides/development/custom-flows/authentication/passkeys).

0 commit comments

Comments
 (0)