Search code examples
javascriptfirebasefirebase-authenticationreact-redux-firebase

Why is the Firebase `accessToken` under such a strange heading?


Background

I have authenticated a user successfully with firebase in the client.

let fbAuthCreds = await this.props.firebase.auth().signInWithEmailAndPassword(email, password);

When I log this I get an object full of very strange looking keys example

Ac, D, Ga, Sa, Yd, ba, fa, g, refreshToken, vc, ze

Most of these I have no idea what they mean (except refreshToken, email .etc)

I found that the actual accessToken id the one that says Yd

Question

Why does firebase send back such strange objects with non human readable names?

Also I would like to send the token to my node server but writing fbAuthCreds.Yd seems not right, how should I retrieve it?

Additional Note

I did get this auth process into redux with react-redux-firebase (Awesome library) and can see a much nicer path to retrieve the data but it fails and says undefined when I try to get hold of it.

Look at line 23-27 there are proper names for the tokens and they should be retrievable

enter image description here


Solution

  • Why does firebase send back such strange objects with non human readable names?

    The code is minified to save bandwidth and memory. Methods and fields that are part of the public API are left unmodified during this process.

    Note that the minified names may change between builds, so you should not rely on them staying the same. Instead use the methods from the public API of the user object, e.g. User.getToken.