Created
March 20, 2020 13:09
-
-
Save apotox/0222fb4ec015bbf5917537872fbf7a1d to your computer and use it in GitHub Desktop.
netlify lambda function protected by firebase auth
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 { success, failed } = require("./services/responses"); | |
const { VerifyToken } = require("./services/security"); | |
exports.handler = async (event, context) => { | |
context.callbackWaitsForEmptyEventLoop = false; | |
const user = await VerifyToken(event.queryStringParameters.token); | |
if (!user) return failed("unauthorized", 401); | |
const secretmessage = "this is a secret"; | |
return success({ | |
message: secretmessage | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment