Skip to content

Commit

Permalink
Remove Firebase App Check (#849)
Browse files Browse the repository at this point in the history
* update firebase functions module

* update roar-firekit and remove lines related to App Check
  • Loading branch information
ksmontville authored Oct 4, 2024
1 parent 56db418 commit f139e5f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 31 deletions.
15 changes: 7 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@bdelab/roam-fluency": "1.11.26",
"@bdelab/roar-firekit": "^9.0.1",
"@bdelab/roar-firekit": "9.1.0",
"@bdelab/roar-letter": "1.11.8",
"@bdelab/roar-multichoice": "^1.11.3",
"@bdelab/roar-pa": "2.2.4",
Expand Down
2 changes: 1 addition & 1 deletion roar-firebase-functions
24 changes: 12 additions & 12 deletions src/config/firebaseRoar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const isEmulated = import.meta.env.VITE_FIREBASE_EMULATOR === 'true';
const useSandbox = import.meta.env.VITE_FIREBASE_DATA_SOURCE === 'sandbox';
const isStaging = import.meta.env.VITE_STAGING_BUILD === 'true';

function setDebugToken(config) {
// For Cypress tests, use the debug token from the Cypress config. If running on localhost, use the VITE_APPCHECK_DEBUG_TOKEN
// environment variable (set as a local environment variable in the .env file). If neither are set, create a new debug token which will be inactive until it is set in the
// Firebase App Check console
config.debugToken = window.Cypress
? Cypress.env('appCheckDebugToken')
: window.location.hostname === 'localhost'
? import.meta.env.VITE_APPCHECK_DEBUG_TOKEN || (self.FIREBASE_APPCHECK_DEBUG_TOKEN = true)
: undefined;
}
// function setDebugToken(config) {
// // For Cypress tests, use the debug token from the Cypress config. If running on localhost, use the VITE_APPCHECK_DEBUG_TOKEN
// // environment variable (set as a local environment variable in the .env file). If neither are set, create a new debug token which will be inactive until it is set in the
// // Firebase App Check console
// config.debugToken = window.Cypress
// ? Cypress.env('appCheckDebugToken')
// : window.location.hostname === 'localhost'
// ? import.meta.env.VITE_APPCHECK_DEBUG_TOKEN || (self.FIREBASE_APPCHECK_DEBUG_TOKEN = true)
// : undefined;
// }

if (isEmulated) {
appConfig = {
Expand Down Expand Up @@ -80,8 +80,8 @@ if (isEmulated) {
};
}

setDebugToken(appConfig);
setDebugToken(adminConfig);
// setDebugToken(appConfig);
// setDebugToken(adminConfig);

export default {
app: appConfig,
Expand Down
18 changes: 9 additions & 9 deletions src/helpers/query/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ export const getAxiosInstance = (db = 'admin', unauthenticated = false) => {
const { roarfirekit } = storeToRefs(authStore);
const axiosOptions = _get(roarfirekit.value.restConfig, db) ?? {};

// Add appCheckToken to the headers if it exists in the firekit config
const appCheckToken = roarfirekit.value[db]?.appCheckToken;

if (appCheckToken) {
axiosOptions.headers = {
...axiosOptions.headers,
'X-Firebase-AppCheck': appCheckToken,
};
}
// // Add appCheckToken to the headers if it exists in the firekit config
// const appCheckToken = roarfirekit.value[db]?.appCheckToken;
//
// if (appCheckToken) {
// axiosOptions.headers = {
// ...axiosOptions.headers,
// 'X-Firebase-AppCheck': appCheckToken,
// };
// }

if (unauthenticated) {
delete axiosOptions.headers;
Expand Down

0 comments on commit f139e5f

Please sign in to comment.