Closed mehroozkhan closed 1 month ago
Hi @mehroozkhan, thanks for opening this issue.
We'll take a look and see if we can figure out what might be happening and post updates here
Hi @mehroozkhan ,
Before displaying the sign-in UI, did you check the user's auth status? One potential issue that could cause the Amplify.AuthError.invalidState
error is attempting to initiate a sign-in process when there is already an active and valid user session.
@5d Thanks for your reply. Yes I do check first if the user is signed in or not through fetchAuthSession API.
static func configure(splashSeen: Bool = false, onboarding: Bool, registration: Bool, keychainServices: KeychainServicesProtocol, completion: @escaping (LaunchInstructor)->Void) {
Task {
let result = await fetchCurrentAuthSession(keychainServices: keychainServices)
if !splashSeen {
completion(.splash)
}
else if !onboarding {
completion(.onboarding)
}
else if result {
completion(.main)
} else {
completion(.auth)
}
}
}
static func fetchCurrentAuthSession(keychainServices: KeychainServicesProtocol) async -> Bool {
do {
let session = try await Amplify.Auth.fetchAuthSession()
if let cognitoTokenProvider = session as? AuthCognitoTokensProvider {
let tokens = try cognitoTokenProvider.getCognitoTokens().get()
keychainServices.setAPIToken(token: tokens.idToken)
}
return session.isSignedIn
} catch {
return false
}
}
our app got approved without changing anything in the apple login now. Very strange Apple!
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
Our app has been rejected from app store multiple times because apple team keep getting error when they try Apple Login. Message From Apple Review Team on every build submission is:
Attachment:![Screenshot-0724-153544](https://github.com/user-attachments/assets/2461f172-6c0f-4077-9b55-916907bf7047)
We have tested our apps in development mode and in Test Flight multiple times with different apple accounts, never got any error. On Investigating the Amplify Error code, it is the AuthError.InvalidState error.
Login Code: `func socialSignInWithWebUI(provider: AuthProvider?) async {
Also tried with the .preferPrivateSession() option, still rejected with this too.
Steps To Reproduce
Expected behavior
Apple Review team successfully login and approve the app.
Amplify Framework Version
2.35.4
Amplify Categories
Auth
Dependency manager
Swift PM
Swift version
5.10
CLI version
12.10.1
Xcode version
15.4
Relevant log output