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