Skip to content

Commit 310b146

Browse files
committed
fix(server): catch expired tokens
1 parent 238fd65 commit 310b146

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/server/auth.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,15 @@ export async function decodeUserToken(
111111

112112
try {
113113
// TODO: should we check for the revoked status of the token here?
114-
return adminAuth.verifyIdToken(token /*, checkRevoked */)
114+
// we await to try/catch
115+
return await adminAuth.verifyIdToken(token /*, checkRevoked */)
115116
} catch (err) {
116117
// TODO: some errors should probably go higher
117118
// ignore the error and consider the user as not logged in
118119
if (isFirebaseError(err) && err.code === 'auth/id-token-expired') {
119120
// Other errors to be handled: auth/argument-error
120121
// the error is fine, the user is not logged in
121-
log('info', 'Token expired -', err)
122+
log('info', 'Token expired, client must revalidate')
122123
// TODO: this error should be accessible somewhere to instruct the user to renew their access token
123124
} else {
124125
// ignore the error and consider the user as not logged in

0 commit comments

Comments
 (0)