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
3 changes: 2 additions & 1 deletion FirebaseAuth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# 8.2.0
- [fixed] Fixed analyze issues introduced in Xcode 12.5. (#8210)
- [fixed] Fixed a bug in the link with email link, Game Center, and phone auth flows. (#8196)

# 8.0.0
- [fixed] Fixed a crash that occurred when assigning auth settings (#7670).
- [fixed] Fixed a crash that occurred when assigning auth settings. (#7670)

# 7.8.0
- [fixed] Fixed auth state sharing during first app launch. (#7472)
Expand Down
21 changes: 21 additions & 0 deletions FirebaseAuth/Sources/User/FIRUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#import "FirebaseAuth/Sources/Backend/RPC/FIRDeleteAccountRequest.h"
#import "FirebaseAuth/Sources/Backend/RPC/FIRDeleteAccountResponse.h"
#import "FirebaseAuth/Sources/Backend/RPC/FIREmailLinkSignInRequest.h"
#import "FirebaseAuth/Sources/Backend/RPC/FIREmailLinkSignInResponse.h"
#import "FirebaseAuth/Sources/Backend/RPC/FIRGetAccountInfoRequest.h"
#import "FirebaseAuth/Sources/Backend/RPC/FIRGetAccountInfoResponse.h"
#import "FirebaseAuth/Sources/Backend/RPC/FIRGetOOBConfirmationCodeRequest.h"
Expand Down Expand Up @@ -718,6 +719,14 @@ - (void)internalUpdateOrLinkPhoneNumberCredential:(FIRPhoneAuthCredential *)phon
completion(error);
return;
}
FIRAuthRequestConfiguration *requestConfiguration =
self.auth.requestConfiguration;
// Update the new token and refresh user info again.
self->_tokenService = [[FIRSecureTokenService alloc]
initWithRequestConfiguration:requestConfiguration
accessToken:response.IDToken
accessTokenExpirationDate:response.approximateExpirationDate
refreshToken:response.refreshToken];
// Get account info to update cached user info.
[self getAccountInfoRefreshingCache:^(
FIRGetAccountInfoResponseUser *_Nullable user,
Expand Down Expand Up @@ -1104,6 +1113,12 @@ - (void)linkWithCredential:(FIRAuthCredential *)credential
if (error) {
callInMainThreadWithAuthDataResultAndError(completion, nil, error);
} else {
// Update the new token and refresh user info again.
self->_tokenService = [[FIRSecureTokenService alloc]
initWithRequestConfiguration:requestConfiguration
accessToken:response.IDToken
accessTokenExpirationDate:response.approximateExpirationDate
refreshToken:response.refreshToken];
[self internalGetTokenWithCallback:^(NSString *_Nullable accessToken,
NSError *_Nullable error) {
if (error) {
Expand Down Expand Up @@ -1165,6 +1180,12 @@ - (void)linkWithCredential:(FIRAuthCredential *)credential
if (error) {
callInMainThreadWithAuthDataResultAndError(completion, nil, error);
} else {
// Update the new token and refresh user info again.
self->_tokenService = [[FIRSecureTokenService alloc]
initWithRequestConfiguration:requestConfiguration
accessToken:response.IDToken
accessTokenExpirationDate:response.approximateExpirationDate
refreshToken:response.refreshToken];
[self internalGetTokenWithCallback:^(NSString *_Nullable accessToken,
NSError *_Nullable error) {
if (error) {
Expand Down
4 changes: 4 additions & 0 deletions FirebaseAuth/Tests/Unit/FIRUserTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -3126,6 +3126,10 @@ - (void)expectVerifyPhoneNumberRequestWithPhoneNumber:(nullable NSString *)phone
}
id mockVerifyPhoneNumberResponse = OCMClassMock([FIRVerifyPhoneNumberResponse class]);
OCMStub([mockVerifyPhoneNumberResponse phoneNumber]).andReturn(phoneNumber);
OCMStub([mockVerifyPhoneNumberResponse IDToken]).andReturn(kAccessToken);
OCMStub([mockVerifyPhoneNumberResponse approximateExpirationDate])
.andReturn([NSDate dateWithTimeIntervalSinceNow:kAccessTokenTimeToLive]);
OCMStub([mockVerifyPhoneNumberResponse refreshToken]).andReturn(kRefreshToken);
callback(mockVerifyPhoneNumberResponse, nil);
});
});
Expand Down