Firebase seems to be a moving target, with PHP a stepchild. (google just upgraded stuff in May, too.) I need one simple working example. This is what I have done:
I go to the Firebase website, obtain an apiKey, authDomain and databaseURL. good. I presume none of these are secret because they have to go into various HTML files.
In Auth (left)
I add Google as a sign-in provider.
I add my OAuth redirect domain to add my site, like
mydomain.com.
Now, I want the simplest possible PHP website script that obtains my web visitor's authenticated email address and prints it. Think:
<?php
$email = getemail( $apikey, $authDomain, $databaseURL );
if (empty($email)) die("your user is refuser");
echo "<html> <body> Your users confirmed email is $email . </body> </html>";
?>
(somewhere, in the background, which I hope I won't have to care about (though others may), Google will have to ask my visitor to login first [if not yet] and then for permission to tell my web site the visitor's Google email; if the user refuses or does not have one, my PHP script should get an empty string, otherwise the authenticated email.)
I hope this is easy, but it relies on deep knowledge of the system and this question will, I hope, help not just me. I tried about 20 different tutorials.
/iaw