TypeScript typings for Firebase App Check API v1
Firebase App Check works alongside other Firebase services to help protect your backend resources from abuse, such as billing fraud or phishing.
For detailed description please check documentation.
Installing
Install typings for Firebase App Check API:
npm install @types/gapi.client.firebaseappcheck-v1 --save-dev
Usage
You need to initialize Google API client in your code:
gapi.load('client', () => {
});
Then load api client wrapper:
gapi.client.load(
'https://firebaseappcheck.googleapis.com/$discovery/rest?version=v1',
() => {
}
);
gapi.client.load('firebaseappcheck', 'v1', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/firebase',
],
immediate = true;
gapi.auth.authorize(
{client_id: client_id, scope: scope, immediate: immediate},
authResult => {
if (authResult && !authResult.error) {
} else {
}
}
);
After that you can use Firebase App Check API resources:
await gapi.client.firebaseappcheck.jwks.get({name: 'name'});
await gapi.client.firebaseappcheck.oauthClients.exchangeAppAttestAssertion({
app: 'app',
});
await gapi.client.firebaseappcheck.oauthClients.exchangeAppAttestAttestation({
app: 'app',
});
await gapi.client.firebaseappcheck.oauthClients.exchangeDebugToken({
app: 'app',
});
await gapi.client.firebaseappcheck.oauthClients.generateAppAttestChallenge({
app: 'app',
});