kreait / firebase-bundle

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

Attempted to load class "Services_FirebaseTokenGenerator" #2

Closed iBasit closed 8 years ago

iBasit commented 8 years ago

I did have installed the composer require firebase/token-generator

I think they have change the path for FirebaseTokenGenerator to Firebase\Token\TokenGenerator, can you please update this on repo?

Auth/TokenGenerator.php

        $this->generator = new \Services_FirebaseTokenGenerator($this->secret);

Attempted to load class "Services_FirebaseTokenGenerator" from the global namespace. Did you forget a "use" statement?

jeromegamez commented 8 years ago

Thanks for the notice - in fact, it was me who refactored the Token Generator for version 3.0 :smile:

On the other hand - is there a reason why you require firebase/token-generator explicitly instead of using the (2.x) dependency that automatically comes with the bundle?

jeromegamez commented 8 years ago

Oh, I see now - the README is not specific enough, sorry for the inconvenience! Until I update the package(s), please require the token generator with the ^2.1 constraint:

composer require firebase/token-generator "^2.1"
iBasit commented 8 years ago

Actually I was using code from the documentation, which lead me to this error.

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

$adminToken     = $tokenGenerator->createAdminToken();

$firebase->setAuthToken($adminToken);

Thanks for the update, I'm already using directly token-generator to generate token for now, but wanted to open issue, so it can be fixed for others.

jeromegamez commented 8 years ago

@iBasit Could you try with the current 0.5 release, please? When updating the version, please also remove the firebase/token-generator dependency from your main composer.json file - as I said, the latest Token Generator is already included with with the firebase library.

Please let me know if it still doesn't work (or if it does). Cheers! :octocat:

iBasit commented 8 years ago

Works fine now :+1: