Firebase AppCheck is not working for angularJS, Showing 100% Unverified requests for Realtime Database
Firebasejs: 3.6.4
Angularfire: 2.3.0
AngularJS: 1.6.0
I have modified the Firebasejs library to add header 'X-Firebase-AppCheck' but after that storage is showing as 100% verified request but Realtime Databse is still showing 100% unverified request.
<script type="module">
import { initializeApp } from 'https://www.gstatic.com/firebasejs/10.4.0/firebase-app.js'
import { initializeAppCheck, getToken, ReCaptchaEnterpriseProvider } from "https://www.gstatic.com/firebasejs/10.4.0/firebase-app-check.js"
const firebaseConfig = {
apiKey: "XXXX",
authDomain: "XXXX.firebaseapp.com",
databaseURL: "https://XXXX.firebaseio.com",
projectId: "XXXX",
storageBucket: "XXX.appspot.com",
messagingSenderId: "XXXX",
appId: "1:CXXX:web:XXX"
};
const app = initializeApp(firebaseConfig);
const appCheck = initializeAppCheck(app,
{
provider: new ReCaptchaEnterpriseProvider("XXXXXX")
})
var appCheckToket;
try {
appCheckToket = await getToken(appCheck,false);
} catch (err) {
console.log(err);
}
token = appCheckToket.token;
</script>
Re-captcha assessment for login action
grecaptcha.enterprise.ready(async () => {
let recaptchaToken = await grecaptcha.enterprise.execute('XXXXX', {action: 'LOGIN'});
var data ={
"event": {
"token": recaptchaToken,
"siteKey": "XXX",
"expectedAction": "LOGIN"
}
};
$http({method: 'POST',
url:"https://recaptchaenterprise.googleapis.com/v1/projects/leaderbord-552b1/assessments?key=AIzaSyA1-mY-XXXXX",
data: JSON.stringify(data)
})
.then(function (success) {
console.log(success);
}, function (error) {
console.log(error);
});
});
Not sure we have to upgrade my application to Angular 16 because I have an application with Angular 16 and not getting this issue.