Skip to content

Commit 6453beb

Browse files
committed
fix(auth): resolve Google login error
1 parent e3bc506 commit 6453beb

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/data/models/sign_in_with_google_request_model.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ part 'sign_in_with_google_request_model.g.dart';
55
@JsonSerializable()
66
class SignInWithGoogleRequestModel {
77
final String idToken;
8+
final String refreshToken;
89

910
SignInWithGoogleRequestModel({
1011
required this.idToken,
12+
required this.refreshToken,
1113
});
1214

1315
Map<String, dynamic> toJson() {
1416
return {
1517
'idToken': idToken,
16-
'refreshToken': '',
18+
'refreshToken': refreshToken,
1719
};
1820
}
1921
}

lib/data/repositories/user_repository_impl.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class UserRepositoryImpl implements UserRepository {
2525
@override
2626
GoogleSignIn get googleSignIn => _googleSignIn;
2727

28-
UserRepositoryImpl(this._authenticationRemoteDataSource, this._tokenLocalDataSource);
29-
28+
UserRepositoryImpl(
29+
this._authenticationRemoteDataSource, this._tokenLocalDataSource);
3030

3131
@override
3232
Future<UserEntity> getUser() async {
@@ -78,9 +78,11 @@ class UserRepositoryImpl implements UserRepository {
7878
final GoogleSignInAuthentication googleAuth =
7979
await googleUser.authentication;
8080
final String? idToken = googleAuth.idToken;
81+
final String? accessToken = googleAuth.accessToken;
8182
if (idToken != null) {
8283
final signInWithGoogleRequestModel = SignInWithGoogleRequestModel(
8384
idToken: idToken,
85+
refreshToken: accessToken ?? '',
8486
);
8587
await _tokenLocalDataSource.deleteToken();
8688
final result = await _authenticationRemoteDataSource

0 commit comments

Comments
 (0)