Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS Callable cloud-functions #221

Open
yamauchieduardo opened this issue May 6, 2021 · 3 comments
Open

HTTPS Callable cloud-functions #221

yamauchieduardo opened this issue May 6, 2021 · 3 comments

Comments

@yamauchieduardo
Copy link

yamauchieduardo commented May 6, 2021

Awesome project! I'm really impress, I'm looking something like this around 3 years. I'll try to use this package in a large production project. But I'm have some questions:

  • This project will implement callable firebase functions in the future?
  • Have any roadmap?

Thanks for the attention.

@yamauchieduardo yamauchieduardo changed the title Callable cloud-functions HTTPS Callable cloud-functions May 6, 2021
@mtwichel
Copy link

mtwichel commented May 28, 2021

Hey! I'm not the maintainer, just someone trying to solve a similar problem. I agree this would be awesome to have, but for now I've found some nice workarounds you could try:

As I understand, the advantage to using callable functions is that it validates the auth token from Firebase auth and parses your json payload into an object.

  • For the first problem, you can validate the tokens pretty easily; you just have to include the token in a header when you make a request (you can get the token from all the client libraries) and validate it on the back end. In fact, I just made a small package for validating the tokens (https://pub.dev/packages/validate_firebase_auth). It's still very new but should work for validating the JWTs from Firebase Auth.
  • For the second, the Functions Framework can already serialize and deserialize dart objects to json as long as you include a .toJson in your response object and a .fromJson in your request object. Example here
  • The only issue is if you write a json serialized function as of now, you can't get to the headers so you'll probably have to do a standard http function for now if you need both functionalities.

EDIT July 2022: This isn't true anymore, you can use json serialized functions and headers at the same time :) See this answer for more details

@novvia-dev
Copy link

Hey there @mtwichel do you happen to remember where that example was?

@mtwichel
Copy link

Hey there @mtwichel do you happen to remember where that example was?

Weird that my link didn't work on my comment originally. Here it is: https://github.com/GoogleCloudPlatform/functions-framework-dart/tree/main/examples/json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants