Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/emulator-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Set Up Node
uses: actions/setup-node@v6
with:
node-version: '20'
node-version: '24'

- name: Install Firebase Tools
run: npm install -g firebase-tools
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ If it saves you or your team time, please consider [sponsoring its development](
and has been removed from the SDK.
* Deprecated classes, methods and class constants have been removed.
* Type declarations have been simplified to reduce runtime overhead (e.g., `Stringable|string` to `string`).
* The transitional `Kreait\Firebase\Contract\Transitional\FederatedUserFetcher::getUserByProviderUid()` method
has been moved into the `Kreait\Firebase\Contract\Auth` interface

See **[UPGRADE-8.0](UPGRADE-8.0.md) for more details on the changes between 7.x and 8.0.**

Expand Down
6 changes: 2 additions & 4 deletions UPGRADE-8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ be trivial (e.g., passing `$user->uid` instead of `$user`). Run your test suite
The following list has been generated with [roave/backward-compatibility-check](https://github.com/Roave/BackwardCompatibilityCheck).

```
[BC] ADDED: Method getUserByProviderUid() was added to interface Kreait\Firebase\Contract\Auth
[BC] CHANGED: Default parameter value for parameter $code of Kreait\Firebase\Exception\Database\TransactionFailed#__construct() changed from 0 to NULL
[BC] CHANGED: Default parameter value for parameter $code of Kreait\Firebase\Exception\Database\UnsupportedQuery#__construct() changed from 0 to NULL
[BC] CHANGED: The number of required arguments for Kreait\Firebase\Exception\Database\UnsupportedQuery#__construct() increased from 1 to 2
Expand Down Expand Up @@ -99,10 +100,6 @@ The following list has been generated with [roave/backward-compatibility-check](
[BC] CHANGED: The parameter $provider of Kreait\Firebase\Contract\Auth#unlinkProvider() changed from array|Stringable|string to a non-contravariant array|string
[BC] CHANGED: The parameter $provider of Kreait\Firebase\Contract\Auth#unlinkProvider() changed from array|Stringable|string to array|string
[BC] CHANGED: The parameter $provider of Kreait\Firebase\Request\UpdateUser#withRemovedProvider() changed from no type to a non-contravariant string
[BC] CHANGED: The parameter $providerId of Kreait\Firebase\Contract\Transitional\FederatedUserFetcher#getUserByProviderUid() changed from Stringable|string to a non-contravariant string
[BC] CHANGED: The parameter $providerId of Kreait\Firebase\Contract\Transitional\FederatedUserFetcher#getUserByProviderUid() changed from Stringable|string to string
[BC] CHANGED: The parameter $providerUid of Kreait\Firebase\Contract\Transitional\FederatedUserFetcher#getUserByProviderUid() changed from Stringable|string to a non-contravariant string
[BC] CHANGED: The parameter $providerUid of Kreait\Firebase\Contract\Transitional\FederatedUserFetcher#getUserByProviderUid() changed from Stringable|string to string
[BC] CHANGED: The parameter $redirectUrl of Kreait\Firebase\Contract\Auth#signInWithIdpAccessToken() changed from no type to a non-contravariant string|null
[BC] CHANGED: The parameter $redirectUrl of Kreait\Firebase\Contract\Auth#signInWithIdpAccessToken() changed from no type to string|null
[BC] CHANGED: The parameter $redirectUrl of Kreait\Firebase\Contract\Auth#signInWithIdpIdToken() changed from no type to a non-contravariant string|null
Expand Down Expand Up @@ -145,6 +142,7 @@ The following list has been generated with [roave/backward-compatibility-check](
[BC] CHANGED: The return type of Kreait\Firebase\RemoteConfig\ConditionalValue#value() changed from no type to string|array
[BC] CHANGED: The return type of Kreait\Firebase\RemoteConfig\TagColor#__toString() changed from no type to string
[BC] REMOVED: Class Kreait\Firebase\Contract\DynamicLinks has been deleted
[BC] REMOVED: Class Kreait\Firebase\Contract\Transitional\FederatedUserFetcher has been deleted
[BC] REMOVED: Class Kreait\Firebase\DynamicLink has been deleted
[BC] REMOVED: Class Kreait\Firebase\DynamicLink\AnalyticsInfo has been deleted
[BC] REMOVED: Class Kreait\Firebase\DynamicLink\AnalyticsInfo\GooglePlayAnalytics has been deleted
Expand Down
26 changes: 0 additions & 26 deletions docs/user-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,32 +165,6 @@ You can retrieve a user by their federated identity provider UID (e.g. Google, F
echo $e->getMessage();
}

.. note::
Since this method couldn't be added to the ``Kreait\Firebase\Contract\Auth`` interface without causing a breaking
change, a new transitional interface/contract named ``Kreait\Firebase\Contract\Transitional\FederatedUserFetcher``
was added. This interface will be removed in the next major version of the SDK.

There are several ways to check if you can use the ``getUserByProviderUid()`` method:

.. code-block:: php

use Kreait\Firebase\Contract\Transitional\FederatedUserFetcher;
use Kreait\Firebase\Factory;

$auth = (new Factory())->createAuth();

if (method_exists($auth, 'getUserByProviderUid')) {
$user = $auth->getUserByProviderUid('google.com', 'google-uid');
}

if ($auth instanceof \Kreait\Firebase\Auth) { // This is the implementation, not the interface
$user = $auth->getUserByProviderUid('google.com', 'google-uid');
}

if ($auth instanceof FederatedUserFetcher) {
$user = $auth->getUserByProviderUid('google.com', 'google-uid');
}

************************************
Get information about multiple users
************************************
Expand Down
3 changes: 1 addition & 2 deletions src/Firebase/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Kreait\Firebase\Auth\SignInWithRefreshToken;
use Kreait\Firebase\Auth\UserQuery;
use Kreait\Firebase\Auth\UserRecord;
use Kreait\Firebase\Contract\Transitional\FederatedUserFetcher;
use Kreait\Firebase\Exception\Auth\AuthError;
use Kreait\Firebase\Exception\Auth\FailedToVerifySessionCookie;
use Kreait\Firebase\Exception\Auth\FailedToVerifyToken;
Expand Down Expand Up @@ -61,7 +60,7 @@
*
* @phpstan-import-type UserRecordResponseShape from UserRecord
*/
final readonly class Auth implements Contract\Auth, FederatedUserFetcher
final readonly class Auth implements Contract\Auth
{
private Parser $jwtParser;

Expand Down
10 changes: 10 additions & 0 deletions src/Firebase/Contract/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ public function getUserByEmail(string $email): UserRecord;
*/
public function getUserByPhoneNumber(string $phoneNumber): UserRecord;

/**
* @param non-empty-string $providerId
* @param non-empty-string $providerUid
*
* @throws UserNotFound
* @throws Exception\AuthException
* @throws Exception\FirebaseException
*/
public function getUserByProviderUid(string $providerId, string $providerUid): UserRecord;

/**
* @throws Exception\AuthException
* @throws Exception\FirebaseException
Expand Down
25 changes: 0 additions & 25 deletions src/Firebase/Contract/Transitional/FederatedUserFetcher.php

This file was deleted.

8 changes: 0 additions & 8 deletions tests/Integration/AuthTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Kreait\Firebase\Auth\SignIn\FailedToSignIn;
use Kreait\Firebase\Auth\UserRecord;
use Kreait\Firebase\Contract\Auth;
use Kreait\Firebase\Contract\Transitional\FederatedUserFetcher;
use Kreait\Firebase\Exception\Auth\InvalidOobCode;
use Kreait\Firebase\Exception\Auth\RevokedIdToken;
use Kreait\Firebase\Exception\Auth\RevokedSessionCookie;
Expand Down Expand Up @@ -496,10 +495,6 @@ public function testGetUserByProviderUid(): void
}

$auth = $this->auth;
if (!($auth instanceof FederatedUserFetcher)) {
$this->markTestSkipped('This test requires a FederatedUserFetcher implementation.');
}

$phoneNumber = '+1234567'.random_int(1000, 9999);

$user = $this->auth->createUser([
Expand All @@ -523,9 +518,6 @@ public function testGetUserByNonExistingProviderUid(): void
}

$auth = $this->auth;
if (!($auth instanceof FederatedUserFetcher)) {
$this->markTestSkipped('This test requires a FederatedUserFetcher implementation.');
}

$this->expectException(UserNotFound::class);
$auth->getUserByProviderUid('phone', '+192837465');
Expand Down
Loading