rest - Turn Firebase 'idToken' into 'access token' with no backend? -


i'm trying use firebase rest api creating anonymous user calling:

https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupnewuser?key=[api_key].

no problem there, response (modified abit secrecy):

{  "kind": "identitytoolkit#signupnewuserresponse",  "idtoken": "eyjhbgcioijsuzi1niisimtpzci6ijm0ntbimgjhowuzmtcymmuwotblzdixmzviy2rin2mxnzdhmzjmmjcifq.eyjpc3mioijodhrwczovl3nly3vyzxrva2vulmdvb2dszs5jb20vzmlzagluyy1hchailcjwcm92awrlcl9pzci6imfub255bw91cyisiml1zci6imzpc2hpbmmtyxbwiiwiyxv0af90aw1lijoxntazmdq1njy4lcj1c2vyx2lkijoiq2hkruj3vk5heva0nmteqza3d1vkmuj3y3q3myisinn1yii6iknoskvcd1zor3lqndzrrenwn3dvsjfcd2n0nzmilcjpyxqioje1mdmwndu2njgsimv4cci6mtuwmza0oti2ocwizmlyzwjhc2uionsiawrlbnrpdgllcyi6e30sinnpz25faw5fchjvdmlkzxiioijhbm9uew1vdxmifx0.jdmupvgvmt6qzoxynpgmqurqg9zrvbpl1kxxmbhoglggi9u1hhwqft5hhkis3qbs87-rr5bceitcu5sehcdlwl3rzex87fcthmy4z-vdquukiqjkhfb0q04sbzbkvuvuug9o-acwmdlwfz54u4alk7kfdlbti3600kqw_4-ugura2jippose9f8hiz_qgao_5kptjo6v4drlhy6pph_h1ko4p1ditwt6pfdn_e_taqxzgsck3ikhu4byuc2dgiufr7q3dfzravqyz2nrpdn6s3z_ndzxikruyaspr7kpeqxgaapcyx84p_gl6r-eefccveourukrvlorpoezoskerg",  "refreshtoken": "aprrrciqiuk5bijijpit-ztsdvn6ybonttcccpoziwaxg9qsclqdr82vqymb0tms1xngpcvlbizgtsdtycvsosygua1r-6rlat83z2jxktangalahqlsc_gpuef7js9pwl8o8pp5kf64coel22pgysd39qwc2z2yf6zjj7xoozf0ealjmkyvzqs",  "expiresin": "3600",  "localid": "chjebwvngyp46kdc07wuj1bwct73" } 

i under impression i've got "authed"/logged in user. , can read data realtime db using idtoken (provided rules user authed).

but doesn't seems case (receive "unauthorized request.") , or missing something. after googling seems need custom backend "convert" idtoken access token. correct?

uhhh. seems documentation bit confusing, says:

supported request types. authenticates request allow access data protected firebase realtime database rules. see rest authentication documentation details.

curl 'https://[project_id].firebaseio/users/jack/name.json?access_token=credential'

but using access_token parameter wrong (in case @ least), in needed use "auth" instead.

so work:

curl 'https://[project_id].firebaseio/users/jack/name.json?auth=myidtokenhere' 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -