Skip to content

Commit 91d1102

Browse files
committed
docs: add app check
1 parent 0824368 commit 91d1102

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

docs/.vitepress/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ function sidebarGuide(): SidebarGroup {
156156
text: 'Storage',
157157
link: '/guide/storage',
158158
},
159+
{
160+
text: 'App Check',
161+
link: '/guide/app-check.md',
162+
},
159163
{
160164
text: 'SSR',
161165
link: '/guide/ssr',

docs/guide/app-check.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
1-
# AppCheck
1+
# Firebase App Check
22

3-
wip
3+
[Firebase App Check](https://firebase.google.com/docs/app-check) helps protect your API resources from abuse by preventing unauthorized clients from accessing your backend resources. It works with both Firebase services, Google Cloud services, and your own APIs to keep your resources safe.
4+
5+
## Installation
6+
7+
Start by adding the `VueFireAppCheck` module to the `VueFire` plugin:
8+
9+
```ts
10+
import { VueFire, VueFireAuth } from 'vuefire'
11+
app.use(VueFire, {
12+
firebaseApp: createFirebaseApp(),
13+
modules: [
14+
// ... other modules
15+
VueFireAppCheck({
16+
// app check options
17+
}),
18+
],
19+
})
20+
```
21+
22+
In order to use App Check you need to enable it in the Firebase Console > App Check. You also need to setup [a reCAPTCHA provider](https://firebase.google.com/docs/app-check), then provide it in the `VueFireAppCheck` module:
23+
24+
```ts{2,9}
25+
import { VueFire, VueFireAuth } from 'vuefire'
26+
import { ReCaptchaV3Provider } from 'firebase/app-check'
27+
28+
app.use(VueFire, {
29+
firebaseApp: createFirebaseApp(),
30+
modules: [
31+
// ... other modules
32+
VueFireAppCheck({
33+
provider: new ReCaptchaV3Provider('...')
34+
isTokenAutoRefreshEnabled: true,
35+
}),
36+
],
37+
})
38+
```
39+
40+
During development, it might be convenient to use a debug token by setting `debug` to `true`. You can then add it to your debug tokens in the Firebase Console > App Check > Apps > Manage Debug Tokens.
41+
42+
```ts{10-11}
43+
import { VueFire, VueFireAuth } from 'vuefire'
44+
import { ReCaptchaV3Provider } from 'firebase/app-check'
45+
46+
app.use(VueFire, {
47+
firebaseApp: createFirebaseApp(),
48+
modules: [
49+
// ... other modules
50+
VueFireAppCheck({
51+
provider: new ReCaptchaV3Provider('...')
52+
// Only use debug during development
53+
debug: process.env.NODE_ENV !== 'production',
54+
isTokenAutoRefreshEnabled: true,
55+
}),
56+
],
57+
})
58+
```

0 commit comments

Comments
 (0)