This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await fetch('https://api.myserver.com/quotes'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const admin = require('firebase-admin'); | |
const app = express(); | |
admin.initializeApp(); | |
const appCheckVerification = async (req, res, next) => { | |
const appCheckToken = req.header('X-Firebase-AppCheck'); | |
if (!appCheckToken) { | |
res.status(401); | |
return next('Unauthorized'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { getToken } = require('firebase/app-check'); | |
const appCheckTokenResponse = await getToken(appCheck); | |
await fetch('https://api.myserver.com/quotes', { | |
headers: { | |
'X-Firebase-AppCheck': appCheckTokenResponse.token, | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
app.get('/quotes', async (req, res) => { | |
const data = await callExternalService(); | |
res.json(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// With App Check JS SDK included as: | |
// <script src="https://www.gstatic.com/firebasejs/9.0.0-beta.7/firebase-app-check-compat.js"></script> | |
const { initializeAppCheck, ReCaptchaV3Provider } = require("firebase/app-check"); | |
const appCheck = initializeAppCheck(app, { | |
provider: new ReCaptchaV3Provider(siteKey), | |
isTokenAutoRefreshEnabled: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import firebase_admin | |
from firebase_admin import messaging | |
def enable_urllib3_logging(): | |
logging.basicConfig() | |
logging.getLogger().setLevel(logging.DEBUG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase_admin | |
from firebase_admin import messaging | |
def enable_http_client_logging(): | |
import http.client as http_client | |
http_client.HTTPConnection.debuglevel = 1 | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const admin = require('firebase-admin'); | |
function enableRequestLogger() { | |
const https = require('https'); | |
const original = https.request | |
https.request = function(options, callback){ | |
console.log(`${new Date().toISOString()} ${options.method} ${options.protocol}//${options.hostname}${options.path}`); | |
return original(options, callback); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
// Lookup user accounts by uid, email, phone number of IdP-assigned uid. | |
// List up to 100 identifiers to lookup. | |
const uids = [ | |
{uid: 'sample-uid-1'}, | |
{uid: 'sample-uid-2'}, | |
{email: '[email protected]'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const admin = require('firebase-admin'); | |
// Usage: node delete_user.js <email> | |
const app = admin.initializeApp(); | |
const email = process.argv[2]; | |
admin.auth().getUserByEmail(email) | |
.then((user) => { | |
return admin.auth().deleteUser(user.uid); |
NewerOlder