File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed
Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## Unreleased
4+
5+ - Fixed [ https://github.com/kreait/firebase-php/issues/65 ] ( kreait/firebase-php#65 ) :
6+ invalid custom token when no claims are given.
7+
38## 1.1.0 - 2017-02-18
49
510- Replaced ` StaticKeyStore ` with ` HttpKeyStore ` , which fetches frech Google Public Keys
Original file line number Diff line number Diff line change 55
66A library to work with [ Google Firebase] ( https://firebase.google.com> ) tokens. You can use it to
77[ create custom tokens] ( https://firebase.google.com/docs/auth/admin/create-custom-tokens ) and
8- [ verify ID Tokens] ( https://firebase.google.com/docs/auth/admin/verify-id-tokens ) .
8+ [ verify ID Tokens] ( https://firebase.google.com/docs/auth/admin/verify-id-tokens ) .
99
1010## Installation
1111
Original file line number Diff line number Diff line change @@ -53,12 +53,10 @@ public function __construct(
5353 */
5454 public function createCustomToken ($ uid , array $ claims = []): Token
5555 {
56- foreach ( $ claims as $ key => $ value ) {
57- $ this ->builder ->set ($ key , $ value );
56+ if ( count ( $ claims) ) {
57+ $ this ->builder ->set (' claims ' , $ claims );
5858 }
5959
60- $ this ->builder ->set ('claims ' , $ claims );
61-
6260 $ this ->builder ->set ('uid ' , (string ) $ uid );
6361
6462 $ now = time ();
Original file line number Diff line number Diff line change @@ -24,4 +24,11 @@ public function testCreateCustomToken()
2424
2525 $ this ->assertInstanceOf (Token::class, $ token );
2626 }
27+
28+ public function testCreateCustomTokenWithEmptyClaims ()
29+ {
30+ $ token = $ this ->generator ->createCustomToken ('some-uid ' );
31+
32+ $ this ->assertInstanceOf (Token::class, $ token );
33+ }
2734}
You can’t perform that action at this time.
0 commit comments