kreait / firebase-tokens-php

A PHP library to work with Firebase tokens
MIT License
223 stars 33 forks source link

docs - include an example of the payload reply #21

Closed rtpHarry closed 4 years ago

rtpHarry commented 4 years ago

Maybe it's just me not knowing enough PHP but it was tricky to know what the reply was when my api was running on a server. I had to write a custom api route to just dump it out (and figure out if I should have been using headers() or payload())

An example of the payload() array in the documentation would have helped eg:

        {
            "iss": "https://securetoken.google.com/{{PROJECTID}}",
            "aud": "{{PROJECTID}}",
            "auth_time": 1578755578,
            "user_id": "c7LXiEYnbPqqbr8OZcNeBcI2PIi1",
            "sub": "c7LXiEYnbPqqbr8OZcNeBcI2PIi1",
            "iat": 1580038499,
            "exp": 1580042099,
            "email": "user@example.com",
            "email_verified": true,
            "firebase": {
                "identities": {
                    "email": [
                         "user@example.com"
                    ]
                },
                "sign_in_provider": "password"
            }
        }
jeromegamez commented 4 years ago

Thanks for letting me know! 🌺

I previously didn't include an example output because it can vary a lot, depending on the token type (custom/ID), the authentication method and the stored user information in the Auth database, but I just added an example output with a disclaimer. Also, I didn't point out that this is justâ„¢ a JWT.

I hope I've now made up for it with the updated README, please let me know if you think it could be made better!