Skip to content

Commit f560843

Browse files
authored
Fix: Clear apiKey on failed auth (#6816)
## Summary Handles the case where an API key is structurally valid but not in our DB. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6816-Fix-Clear-apiKey-on-failed-auth-2b26d73d3650817ab34edfa380795178) by [Unito](https://www.unito.io)
1 parent 9da82f4 commit f560843

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/stores/apiKeyAuthStore.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ export const useApiKeyAuthStore = defineStore('apiKeyAuth', () => {
2424
const isAuthenticated = computed(() => !!currentUser.value)
2525

2626
const initializeUserFromApiKey = async () => {
27-
const createCustomerResponse = await firebaseAuthStore.createCustomer()
27+
const createCustomerResponse = await firebaseAuthStore
28+
.createCustomer()
29+
.catch((err) => {
30+
console.error(err)
31+
return
32+
})
2833
if (!createCustomerResponse) {
2934
apiKey.value = null
3035
throw new Error(t('auth.login.noAssociatedUser'))

0 commit comments

Comments
 (0)