Download the PHP package kreait/firebase-tokens without Composer
On this page you can find all versions of the php package kreait/firebase-tokens. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kreait/firebase-tokens
More information about kreait/firebase-tokens
Files in kreait/firebase-tokens
Package firebase-tokens
Short Description A library to work with Firebase tokens
License MIT
Homepage https://github.com/kreait/firebase-token-php
Informations about the package firebase-tokens
Firebase Tokens
A library to work with Google Firebase tokens. You can use it to create custom tokens and verify ID Tokens.
Achieve more with the Firebase Admin SDK for PHP (which uses this library).
The future of the Firebase Admin PHP SDK
Please read about the future of the Firebase Admin PHP SDK on the SDK's GitHub Repository.
- Installation
- Simple Usage
- Create a custom token
- Verify an ID token
- Verify a Session Cookie
- Tokens
- Tenant Awareness
- Advanced Usage
- Cache results from the Google Secure Token Store
- Supported Versions
Installation
Simple usage
Create a custom token
More information on what a custom token is and how it can be used can be found in Google's official documentation.
Verify an ID token
The ID token verification methods included in the Firebase Admin SDKs are meant to verify ID tokens that come from the client SDKs, not the custom tokens that you create with the Admin SDKs. See Auth tokens for more information.
Verify a Session Cookie
Session cookie verification is similar to ID Token verification.
See Manage Session Cookies for more information.
Tokens
Tokens returned from the Generator and Verifier are instances of \Kreait\Firebase\JWT\Contract\Token
and
represent a JWT. The displayed outputs are examples and vary depending on
the information associated with the given user in your project's auth database.
According to the JWT specification, you can expect the following payload fields to be always
available: iss
, aud
, auth_time
, sub
, iat
, exp
. Other fields depend on the
authentication method of the given account and the information stored in your project's
Auth database.
Tenant Awareness
You can create custom tokens that are scoped to a given tenant:
Similarly, you can verify that ID tokens were issued in the scope of a given tenant:
Session cookies currently don't support tenants.
Advanced usage
Cache results from the Google Secure Token Store
In order to verify ID tokens, the verifier makes a call to fetch Firebase's currently available public keys. The keys are cached in memory by default.
If you want to cache the public keys more effectively, you can initialize the verifier with an implementation of psr/simple-cache or psr/cache to reduce the amount of HTTP requests to Google's servers.
Here's an example using the Symfony Cache Component:
Supported Versions
Only the latest version is actively supported.
Earlier versions will receive security fixes as long as their lowest PHP requirement receives security fixes. For example, when a version supports PHP 7.4 and PHP 8.0, security support will end when security support for PHP 7.4 ends.
Version | Initial Release | Supported PHP Versions | Status |
---|---|---|---|
5.x |
25 Nov 2023 | ~8.1.0, ~8.2.0, ~8.3.0 |
Active |
4.x |
26 Nov 2022 | ~8.1.0, ~8.2.0, ~8.3.0 |
Security Support |
3.x |
25 Apr 2022 | ^7.4, ^8.0 |
End of life |
2.x |
03 Jan 2022 | ^7.4, ^8.0 |
End of life |
1.x |
06 Feb 2017 | >=5.5 |
End of life |
License
The MIT License (MIT). Please see License File for more information.
All versions of firebase-tokens with dependencies
ext-json Version *
ext-openssl Version *
beste/clock Version ^3.0
fig/http-message-util Version ^1.1.5
guzzlehttp/guzzle Version ^7.8
lcobucci/jwt Version ^5.2
psr/cache Version ^1.0|^2.0|^3.0