Using web only with firebase auth

Hi all,

I am trying to use rwjs web only with firebase auth.

Unfortunately, I am getting this error:

[webpack-dev-server] [HPM] Error occurred while proxying request localhost:8910/graphql to http://[::1]:8911/ [ECONNREFUSED]

Do you know how to fix it and disable the proxy requests to api server?

Thanks in advance for any pointers.

Hi @adrianLsk just to clarify, you only have web but no api side. And have used the sets up auth generator to use firebase auth?

All Redwood auth providers use the api side to verify the auth provider JWT and also the api side returns the current user.

I cannot see a way to use just the web side with any Redwood auth provider, unfortunately.

Hi @dthyresson, thanks for your reply. Yes, that is correct. no API at all.

I had to set it up manually becuase “yarn rw setup auth firebase” was giving me another error:
Unknown argument: firebase

In the end I disabled the graphql call to api by setting proxy to null in the webpack.config.js

It seems to work so far. I plan to use only firebase web sdk which contains getIdTokenResult to fetch and refresh the JWT instead of using the API.

So, without the api, Redwood won’t provide auth, route protection, graphql, data fetching with cells … out of curiosity what is it with just the RedwoodJS web side + firebase that works for your app stack?

Is there something we can do to help you install Firebase auth with Redwood?

I see.

I have an existing app in gatsbyjs that is using firebase web sdk (I am using firebase auth, firestore and storage purely with the sdk) with reactfire hooks (using rxjs) and a few trusted 3rd party apis using react-query. I saw that there is community integration for react-query and in general, I like how redwoodjs is structured, the convetions, commands to bootstrap pages etc.

So the idea was to try to migrate the app but with the api turned off as described in the cookbook. I was thinking that I might turn the api on in the future if there is a need for it when improving the app.

I looked at the implementation of AuthProvider and getCurrentUser is the only method using the graphql. I managed to avoid it using skipFetchCurrentUser argument in AuthProvider, and because userMetaData includes firebase user information including claims (which are used for roles) that’s all auth information that I needed. This seemed to work with private Set of routes otherwise I was getting the error from failed graphl call.

I am not sure if my use case is something that a wider community would go for. I see it more as an edge case. But so far so good. I am fine with it as-is. As a next step, I want to create a custom implementation for the cells using firebase sdk and reactfire.

Thanks for the clarifications.