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