Firebase facebook auth with custom JWT payload

189 views
Skip to first unread message

Jakub Stransky

unread,
Aug 22, 2016, 11:09:33 AM8/22/16
to Firebase Google Group
Hello,

I would like to use awesome capabilities of firebase for auth using variety of possibilities for user log-in but I would need to achieve a state when returned JWT token has some custom payload. In the documentation there is mentioned custom token generation but if I understand it correctly it also involves  a need to authenticated user etc. When client is given custom token he can sign in to firebase services. While what we really intended was using all sign-in capability of fire base and use token for carrying in important stuff. Is there some simple way how to achieve this scenario?

The only possibility I can think of right now is:
1) having client to login via standard firebase capabilites (signInWithXXX) e.g. Facebook -> which returns TokenId (which essentially JWT with empty payload)
2) via call back direct the client to server token generation - where we reuse uid and generate custom token and pass it back to client
3) client performs singInWithCustomToken


This process seems me awkward this double sign-in. 
One alternative would be use tokenId and store payload to firebase dbatabase but than all services gets this information from the database. The idea of token which holds all the data is much more appealing to us.

Is there a better way how to do it? Any suggestions?

Thaks

Jacob Wenger

unread,
Aug 22, 2016, 1:58:01 PM8/22/16
to fireba...@googlegroups.com
This seems to be tied with https://groups.google.com/forum/#!msg/firebase-talk/7Bm9NQjVQuk/Fze8EPUaDAAJ, so I'm just going to answer it here.

This seems like an XY problem. What are you actually trying to do? The auth flow you describe doesn't make a whole lot of sense to me and I can't think of a valid use case for it. If you want to store custom data associated along with each user, you should just use the Realtime Database, as Kato describes here.

Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/f6b8263b-926a-4ea4-8adb-aa13ffe60a9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages