ktamas77/firebase-php

How to create DEFAULT_TOKEN

Closed this issue · 12 comments

Hello guys.
How do I get DEFAULT_TOKEN configuration ?
I was using Firebase token generator php but it not working.
Can you help me ?
Thank a lot

@anhnt0212 same problem. Have you any solution?

@greabock i don't have :(

Can you help me ?

On Mon, Aug 22, 2016 at 6:18 PM, Parth Dabhi (iOS & Android developer) <
notifications@github.com> wrote:

@ktamas77 https://github.com/ktamas77 @llbbl https://github.com/llbbl
@brianpilati https://github.com/brianpilati @craigrusso
https://github.com/craigrusso can you help ?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#46 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMkHvQFADBySMb_3IE8RLr_lliP80huSks5qiYV1gaJpZM4JQhvo
.

Chin up champs, in your firebase console, just go to the project settings, then to the tab database and then copy the secret key. Worked like a charm for me!

firebasephpdefaulttoken

@skizzo tks a lot.let me check again :D

Does this database secret override all the security rules defined?

@martisj i think it no

I believe this is deprecated now? Or am i looking at the wrong thing?

image

yes the secret still works but it is deprecated. you ought to be using Service Accounts now but this library does not yet support it

v1.x/2.x Firebase JWT token's that @anhnt0212 is using are not the same as the secret.

you could try kreait's version instead, which supports the Service Accounts used by v3.x firebase

having looked at that codebase, it's not simple so it's no small task that we are asking @ktamas77 to do to update this library to the new version by the way

what are you actually trying to do @anhnt0212 ?

ps if you use REST to access Firebase .json I believe authentication works in either of the following ways

...something.json?auth={secret} // DEFAULT_TOKEN in ktamas77's docs
...something.json?auth={JWT}
...something.json?access_token={v3_service_account_oauth_token_etc}

I believe the middle one is what the token generator library you are using provides @anhnt0212

as you can see the token is passed in the querystring options for auth
https://github.com/ktamas77/firebase-php/blob/master/src/firebaseLib.php#L107

you could try creating a JWT token with Firebase token generator using your secret, and then pass that token into @ktamas77's library... if you don't want to pass your secret directy. I've not tried it though. it depends if it should be passed as auth= or access_token=