0

I have a mobile app that has data & auth on Firebase. I want to create a Google Action for these same users.

This post asked basically the same question and the top reply says "However, you can use Firebase Auth if you're willing to setup your own OAuth2 server. If you set one up you can have them login using Firebase Sign-In, generate the token and store it against their Firebase ID, and issue that token to the Assistant client. When you get that token back, you can easily associate it back to the Firebase ID."

Does anybody have an example or a more in depth guideline of how to accomplish this?

manta2020
  • 51
  • 2

1 Answers1

0

That post you linked is quite old and AoG is changing fairly rapidly. Case-in-point, they released their new "conversational actions" just last month (2020-06), and with these it is quite easy to use Google accounts and firebase auth.

The docs for this are here BUT don't use the code provided in the docs - I found it to be quite broken as of 2020-07 - use the sample actions on their github instead.

This gives the user an easy way to connect their google account to your action with just their voice resulting in a Firebase authentication.

Now the part I'm not sure about is, if your action and your app use use the same GCP/Firebase project and the same client ID, will they produce the same 'user uid' in firebase auth. Probably not, but if so you would be done and the whole thing would be very easy.

Tom
  • 17,103
  • 8
  • 67
  • 75
  • Note that the question is about "Firebase Auth" which is not "Google Auth". While you can do Google Auth as part of Firebase Auth, you can also use other Auth providers. While the answer is old - it is still completely valid. – Prisoner Jul 13 '20 at 18:16
  • I meant that the user would do Google sign-in and it would be implemented as Firebase auth, and then if the user also did Google sign-in in your Android app... the above applies. If you not using google sign-in in your android app then, yes, there is no shortcut. But either way I think the new docs I linked - which address both scenarios - are relevant and should be given priority over stuff oriented towards older versions of AoG. – Tom Jul 13 '20 at 18:41
  • Thanks @Tom for the resources but I anticipate many users having email & password sign ups with firebase in addition to Google sign-in. I am still not sure how to set up an OAuth2 server with Firebase Auth. – manta2020 Jul 13 '20 at 19:07
  • @Prisoner You said you use Firebase Auth and Firebase Sign-In (and Firebase Hosting and Firebase Functions) as the basis for your OAuth2 implementation. Do you have a source on how you accomplished this? – manta2020 Jul 14 '20 at 17:12
  • I'm trying to find the time to write up a full response for you, @manta2020. – Prisoner Jul 14 '20 at 17:41
  • @Prisoner Hi, I still haven't fixed this problem do you think you'd be able to help me out? – manta2020 Aug 21 '20 at 01:27