Skip to content

Commit

Permalink
Fix #21: Pass localId to user update request (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeySreelal authored Jul 9, 2024
1 parent 2edb5b0 commit 336de14
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ jobs:
run: dart analyze

- name: Run tests
run: |
${{github.workspace}}/scripts/coverage.sh
run: ${{github.workspace}}/scripts/coverage.sh

- name: Upload coverage to codecov
run: curl -s https://codecov.io/bash | bash
4 changes: 4 additions & 0 deletions packages/dart_firebase_admin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased fix

- Fixes crash when updating users (thanks to @HeySreelal)

## 0.3.1

- **FEAT**: Use GOOGLE_APPLICATION_CREDENTIALS if json value (#32).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@ abstract class _AbstractAuthRequestHandler {
phoneNumber: properties.phoneNumber?.value,
// Will be null if deleted or set to null. "deleteAttribute" will take over
photoUrl: properties.photoURL?.value,
// The UID of the user to be updated.
localId: uid,
);

final response = await _httpClient.setAccountInfo(request);
Expand Down
22 changes: 22 additions & 0 deletions packages/dart_firebase_admin/test/auth/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,28 @@ void main() {
expect(user.uid, importUser.uid);
});
});

group('updateUser', () {
test('supports updating email', () async {
final user = await auth.createUser(
CreateRequest(
email: '[email protected]',
),
);

final updatedUser = await auth.updateUser(
user.uid,
UpdateRequest(
email: '[email protected]',
),
);

expect(updatedUser.email, equals('[email protected]'));

final user2 = await auth.getUserByEmail(updatedUser.email!);
expect(user2.uid, equals(user.uid));
});
});
}

Future<void> cleanup(Auth auth) async {
Expand Down

0 comments on commit 336de14

Please sign in to comment.