Skip to content

Commit 65eddd4

Browse files
committed
chore: rename
1 parent bad7e3c commit 65eddd4

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

packages/nuxt/src/runtime/admin/plugin-auth-user.server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ export default defineNuxtPlugin(async (nuxtApp) => {
1717

1818
if (token) {
1919
const adminApp = nuxtApp.$firebaseAdminApp as AdminApp
20-
const auth = getAdminAuth(adminApp)
20+
const adminAuth = getAdminAuth(adminApp)
2121

2222
try {
2323
// TODO: should we check for the revoked status of the token here?
24-
const decodedToken = await auth.verifyIdToken(token)
25-
user = await auth.getUser(decodedToken.uid)
24+
const decodedToken = await adminAuth.verifyIdToken(token)
25+
user = await adminAuth.getUser(decodedToken.uid)
2626
} catch (err) {
2727
// TODO: some errors should probably go higher
2828
// ignore the error and consider the user as not logged in
2929
if (isFirebaseError(err) && err.code === 'auth/id-token-expired') {
30+
// Other errors to be handled: auth/argument-error
3031
// the error is fine, the user is not logged in
3132
} else {
3233
// ignore the error and consider the user as not logged in

src/server/app-check.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,29 @@ export function VueFireAppCheckServer(
2929
const token = getGlobalScope(firebaseApp, app).run(() => ref<string>())!
3030
app.provide(AppCheckTokenInjectSymbol, token)
3131

32+
console.log('[VueFire]: Initializing AppCheck on the server')
3233
const appCheck = initializeAppCheck(firebaseApp, {
3334
provider: new CustomProvider({
34-
getToken: () =>
35-
getAdminAppCheck(adminApp)
36-
// NOTE: appId is checked on the module
35+
getToken: () => {
36+
console.log('[VueFire]: Getting Admin AppCheck')
37+
const adminAppCheck = getAdminAppCheck(adminApp)
38+
// NOTE: appId is checked on the module
39+
console.log(
40+
`[VueFire]: Getting creating token for app ${firebaseApp.options
41+
.appId!}.`
42+
)
43+
return adminAppCheck
3744
.createToken(firebaseApp.options.appId!, { ttlMillis })
38-
.then(({ token, ttlMillis: expireTimeMillis }) => ({
39-
token,
40-
expireTimeMillis,
41-
})),
45+
.then(({ token, ttlMillis: expireTimeMillis }) => {
46+
console.log(
47+
`[VueFire]: Got AppCheck token from the server: ${token}`
48+
)
49+
return {
50+
token,
51+
expireTimeMillis,
52+
}
53+
})
54+
},
4255
}),
4356
isTokenAutoRefreshEnabled: false,
4457
})

0 commit comments

Comments
 (0)