kreait / firebase-bundle

A Symfony Bundle for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
140 stars 27 forks source link

Authenticate user #1

Closed elodieirdor closed 9 years ago

elodieirdor commented 9 years ago

Hello, Thanks for this bundle! I was wondering, is there any way to authenticate a user with this current version?

jeromegamez commented 9 years ago

Hi Elodie,

this is not yet possible with the bundle, but I am working on it - the base library this bundle is based upon already has the authentication support, so you could implement that in the meantime: https://github.com/kreait/firebase-php/releases

I hope that I can update the bundle in the next week.

Cheers :octocat: Jérôme

elodieirdor commented 9 years ago

OK, I was thinking about doing a PR after updating firebase-php to version 0.6.1 but if you're going to work on it, I can wait :)

Thanks again.

jeromegamez commented 9 years ago

If you already have something, please proceed - I am only hoping to get to it next week :)

elodieirdor commented 9 years ago

I don't have anything yet. I just took a look around and found an issue : the http-adapter-bundle requires version 0.6.0 for the http-adapter whereas firebase-php requires version 0.7.0. I'll try to work on it this weekend.

jeromegamez commented 9 years ago

I just released a new version of the bundle which includes the latest firebase-php release. It's a bit rough on the edges and includes manual work in your application code, but I think it is a start.

https://github.com/kreait/firebase-bundle#authentication

It includes adding a new configuration parameter secret to a connection, an additional composer require firebase/token-generator and the addition of some code in your controller or service:

$firebase       = $this->container->get('kreait_firebase.connection.main');
$tokenGenerator = $firebase->getConfiguration()->getAuthTokenGenerator();

$adminToken     = $tokenGenerator->createAdminToken();

$firebase->setAuthToken($adminToken);

Please let me know if this is a starting point you could work with.

elodieirdor commented 9 years ago

Hello Jérôme,

Thanks a lot it's perfectly working! You did a great job.

Cheers

jeromegamez commented 9 years ago

Thanks for the feedback, Elodie - I will close this issue then :)