Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS ApiGateway Custom authorization with Firebase

I will explain my use case. I have a web app. First, the app attempts to login to firebase and it gets back a token. I want to use the token issued by firebase to access lambda function through api gateway. Is there a mechanism to validate Firebase tokens in AWS ApiGateway?

design doc

like image 975
Supun Madushanka Avatar asked Feb 27 '18 09:02

Supun Madushanka


People also ask

Can I use firebase with AWS?

With Firebase consisting of proprietary services, APIs, and an SDK, a migration to AWS requires application refactoring – introducing a new architecture using AWS services, and rewriting parts of the codebase to use them accordingly.

Does API gateway pass authorization header to Lambda?

For a Lambda authorizer of the REQUEST type, API Gateway passes request parameters to the authorizer Lambda function as part of the event object. The request parameters include headers, path parameters, query string parameters, stage variables, and some of request context variables.


1 Answers

You have to write custom Authorizers lambda function for validate your firebase tokens.

This lambda function hit before execute your lambda function.

following diagram explain how it's work

enter image description here

For write custom Authorizers function follow this reference. For token validation you can use firebase sdk and its references.

like image 198
Niroshan Ranapathi Avatar answered Nov 06 '22 05:11

Niroshan Ranapathi