How can I authenticate my user with a Firebase Token?

Hello!
I’m using the Token Base Auth because I need to sign in and sign up the users with Firebase Auth.
Firebase has a REST API that I can use to sign in my users and get the auth token, this works fine and I can store the token successfully, however when I try to fetch the user data I need to use a post a method that sends de token as a parameter and the Token Base Auth doesn’t accept this type of method so I’m kinda stuck there at the user authentication.

Here’s the firebase method I need to use https://firebase.google.com/docs/reference/rest/auth#section-get-account-info

I would also want to know how to refresh de token because it has an expiration and it doesn’t seem to be updating.

Thank you!

1 Like

Well, I think you’re hitting a limitation of our plugin here. Because it doesn’t handle a case where getMe is a POST request using the token as a query param. To be honest its not a common pattern at all, I would even say its wild haha
(I mean, its even in the function name, get account info :sob:)

You can make a feature request on feedback.weweb.io so we can try to support this case!

In the meantime I think you should probably handle the authentication yourself. Its totally doable and fine if everything you want to be private is already protected by your backend (like firebase).

  1. Create 2 variables, auth token and user and toggle preserve on navigation + local storage on both
  2. Create your signup/login workflows using the endpoints from the doc and our REST API plugin.
  3. You can create a workflow on app load or on page load and redirect your users to the login page if they are not logged in

It should be enough, it depends of your needs!

Ok I’ll try that, thank you Alexis :blush:

Hi I am also trying to setup firebase for push notifications but not able to, can you guide me please. @esmememe

Hello there @Alexis. I new to WeWeb, but very exited with learning it. I like Xano and Supabase, but it would be interesting to have a Firebase native alternativa too. I posted the feature request, but would also be willing to contribute to the implementation if you guys are interested.
I’m the main developer on the Firebase Auth, Firestore & Storage plugin for Bubble (link), so it wouldn’t be the first contribution to Firebase integration on no-code/low-code web platforms.

I know I can do it other ways, but I’d rather make something that helps the community too and integrate it to the “usual” WeWeb development flow.

Hello @AugustoSalles, I actually wrote a blog article about how to implement Firebase in WeWeb, it’s a little technical, but once the setup, that I also provide a quite good code snippet for is done, it’s all about following Firebase’s docs.

Currently, unfortunately it’s the only possible way, as I also mention in the blog, because you can’t use the NPM plugin as it doesn’t support it, and WeWeb’s Plugin API, or any tooling related to public plugin creation is not yet available to the Public.

Thanks Broberto. I had already seen your article. It’s actually what I meant by “I know I can do it other ways”. I was considering your approach. :metal::grin:

1 Like

We’re actively working to open up plugin development to everyone this summer. In the next couple of days/weeks you should be able to develop this kind of plugin by yourself, by following a documentation and exploring our own plugins shared in our public github.

Thanks for putting your interest in our platform, I hope you will enjoy the development experience :smiley:

1 Like

Nice!!! Thanks @Alexis
I’ll be looking forward to it.