Simple security library to work with firebase
exports.endpoint = onRequest( async (request, response) => {
if ( await simpleSecurity(request, { allow_jwt:false, allow_s2s:true, allow_basic:false }) ){
if (request.method === "POST"){
//....
}
return response.sendStatus(405);
}else{
return response.sendStatus(403);
}
}
- AUTHENTICATION_FIREBASE_API_KEY
- AUTHENTICATION_FIREBASE_AUTH_DOMAIN
- AUTHENTICATION_FIREBASE_PROJECT_ID
- AUTHENTICATION_FIREBASE_STORAGE_BUCKET
- AUTHENTICATION_FIREBASE_MESSAGEING_SENDER_ID
- AUTHENTICATION_FIREBASE_APP_ID
- SECURITY_S2S_UUID_REQUIRED
- DEFAUT_ALLOW_JWT
- DEFAULT_ALLOW_BASIC
- DEFAULT_ALLOW_S2S
- DEFAULT_JWT_BLOCK_ANONYMUS
- REQUIRE_UUID_ON_JWT
- REQUIRE_UUID_ON_BASIC
- AUTHENTICATION_S2S_TOKEN
- API_TOKEN_URL_VALIDATOR