Closed JurajBegovac closed 1 year ago
@JurajBegovac Can you share your amplifyconfiguration.json (with identifiable details redacted)?
@phantumcode but I added awsConfig
in my initial post. We don't use amplifyconfiguration.json
because we want to insert some data dynamically.
So we add it like this:
AuthCategoryConfiguration(
plugins: [
"awsCognitoAuthPlugin": [
"CognitoUserPool": [
"Default": [
"PoolId": .string("poolId"),
"Region": .string("region"),
"AppClientId": .string("clientId"),
"AppClientSecret": .string("clientSecret")
]
],
"Auth": [
"Default": [
"authenticationFlowType": "CUSTOM_AUTH"
]
]
]
]
)
@JurajBegovac Since you didn't use the Amplify CLI and don't have an amplifyconfiguration.json, it's difficult to reproduce the issue without additional context or specific details of how you've configuration authentication with MFA. Can you provide additional logs or console logs when you're seeing the issue? Is there an error be thrown or captured?
Some other information that would help:
confirmSignUp
, please confirm that you have email registration/verification disabled in Cognito. @JurajBegovac Additional logging can be enabled by adding this line when configuring Amplify plugins:
Amplify.Logging.logLevel = .verbose
I'm having the same issue as OP. I'm not sure how helpful this will be, but here is my amplify configuration.json file:
To answer your follow up questions:
As per the instructions in the setup guide, I have 3 lambdas to execute the custom auth flow. Looking into the cloudwatch logs / metrics I can see that the Define Challenge and Create Challenge lambdas were invoked with the sign in method invocation, but there is never an invocation of the Verify Challenge lambda when the confirm sign in method is executed. On my app, I know that the process must be hung somewhere because after submitting the challenge code (while waiting for the confirmation), if I go back to the sign in page and sign in using a different email / phone number, that new sign in call will not finish either. Looks like something is going wrong in the verify code before it reaches my lambda.
@JurajBegovac @patrickjohnson97 Do you have client side log? From Xcode console or logs from your iOS app or a stacktrace in a debug session?
@patrickjohnson97 If you have email verification enabled, are you calling confirmSignUp
with the email verification code prior to calling signIn
and confirmSignIn
?
@phantumcode Ok here is some verbose log: After I make signup, then signin (that's ok) - then I call confirmCredential - and then nothing happens:
Thank you for the logs, @JurajBegovac this gives us more insight into the internals now. Looks like the auth plugin is waiting for confirm signIn api call to be invoked to continue the custom auth flow. Are you invoking Amplify.Auth.confirmSignIn
in your flow?
Speaking for myself, I have the same logs and I am indeed invoking the confirmSignIn method with withSRP strategy (my custom lambda handles the SRP_A attribute). I have tried withoutSRP and updating my Define Auth Challenge lambda to match the example in the Amplify docs, but I am still facing this same issue.
Can you retry and test with the latest Amplify version 2.2.1
It is still not working after pulling in the new Amplify version. I was poking around today trying to see if I could get anything to work and I deleted the user I was trying to sign in with and created a new user with the same phone number. This may be unrelated, but I witnessed new behavior that I had not seen since the last version of Amplify I had (1.5X). I called .signUp, then .confirmSignUp with the confirmation code, and that was successful (yay!). However, then I saw these logs:
Confirm signUp succeeded
2022-12-21 09:00:18.117938-0800 radarios[24248:4410762] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitializeRefreshSession.swift Starting execution
2022-12-21 09:00:18.117990-0800 radarios[24248:4410762] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitializeRefreshSession.swift Sending event RefreshSessionEvent.throwError
2022-12-21 09:00:18.118224-0800 radarios[24248:4411353] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signedOut" = {
lastKnownUserName = "(nil)";
};
"AuthorizationState.refreshingSession" = {
existing = noCredentials;
refreshState = {
"RefreshSessionState.notStarted" = {
};
};
};
};
}
2022-12-21 09:00:18.118367-0800 radarios[24248:4410762] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InformSessionError.swift Starting execution
2022-12-21 09:00:18.118391-0800 radarios[24248:4410762] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InformSessionError.swift Sending event AuthorizationEvent.receivedSessionError
2022-12-21 09:00:18.118409-0800 radarios[24248:4411353] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signedOut" = {
lastKnownUserName = "(nil)";
};
"AuthorizationState.refreshingSession" = {
existing = noCredentials;
refreshState = {
"RefreshSessionState.error" = {
error = "AWSCognitoAuthPlugin.FetchSessionError.noCredentialsToRefresh";
};
};
};
};
}
2022-12-21 09:00:18.118592-0800 radarios[24248:4411353] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signedOut" = {
lastKnownUserName = "(nil)";
};
"AuthorizationState.error" = {
Error = "AWSCognitoAuthPlugin.AuthorizationError.sessionError(AWSCognitoAuthPlugin.FetchSessionError.noCredentialsToRefresh, noCredentials)";
};
};
}
AuthError: There is no user signed in to retreive cognito tokens
Recovery suggestion: Call Auth.signIn to sign in a user and then call Auth.fetchSession
When I relaunched my app - I was no longer signed in (thus having to go back through the broken sign in flow again, sigh). Hopefully this information is relevant to the case.
I know it's the holiday season, so I'm not expecting much progress on this right now. However, I do see this was marked as pending response from requester. As I am not the requester but I am affected by the same issue, should I reopen a new ticket or can we keep this open to continue tracking this issue?
Hi @patrickjohnson97
Invoking Amplify.Auth.signUp
does not automatically signIn the user. You need to invoke Amplify.Auth.signIn
and check its result, if the result next step is .done
(result.nextStep == .done
) the user is authenticated. If it is not .done
you need to invoke subsequent api as mentioned here - https://docs.amplify.aws/lib/auth/signin_next_steps/q/platform/ios
Once the user is authenticated your can call other apis like Amplify.Auth.fetchAuthsession
to get authenticated credentials.
From your logs it is not clear regarding what response you are getting when you invoke Amplify.Auth.signIn
.
As I am not the requester but I am affected by the same issue, should I reopen a new ticket or can we keep this open to continue tracking this issue?
We are still trying to figure out if your issue is same as the requester's, for now we can keep this GitHub issue assuming that they are the same. @JurajBegovac are you still facing the same issue with the latest Amplify swift release?
@royjit Just to clarify - I am still seeing the aforementioned hanging confirm sign in process. Here is every log I have for the entire auth process (starting immediately after I press the "Sign in" button on my app:
Signing in with radar...
2022-12-30 14:05:47.951377-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IntializeSignInFlow.swift Starting execution
2022-12-30 14:05:47.951437-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] Credential Store state change:
loadingStoredCredentials
2022-12-30 14:05:47.951457-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
2022-12-30 14:05:47.951483-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.notStarted" = {
};
};
"AuthorizationState.signingIn" = {
};
};
}
2022-12-30 14:05:47.952248-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "<REDACTED>")
2022-12-30 14:05:47.958872-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
2022-12-30 14:05:47.958907-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
2022-12-30 14:05:47.958914-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
2022-12-30 14:05:47.959278-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Credential Store state change:
error(KeychainStoreError: Unable to find the keychain item
Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at:
file: /Users/patrickjohnson/Library/Developer/Xcode/DerivedData/radarios-dknagqfhvptgcvcevboslsbwdhqv/SourcePackages/checkouts/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift
function: recoverySuggestion
line: 69)
2022-12-30 14:05:47.959298-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Credential Store state change:
idle
2022-12-30 14:05:47.973842-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPoolsAndIdentityPools(["clientId": "6num****35nf", "poolId": "us-w****54x6", "clientSecret": "(nil)", "region": "<REDACTED>", "hostedUI": "[\"clientId\": \"6num****35nf\", \"clientSecret\": \"(nil)\", \"oauth\": \"[\\\"domain\\\": \\\"rada****.com\\\", \\\"signInRedirectURI\\\": \\\"rada***s://\\\", \\\"signOutRedirectURI\\\": \\\"rada***s://\\\"]\"]", "pinpointAppId": "(nil)", "endpoint": "N/A"], ["region": "<REDACTED>", "poolId": "us-w****9f49"]), userPoolConfigData: Optional(["clientId": "6num****35nf", "poolId": "us-w****54x6", "clientSecret": "(nil)", "region": "<REDACTED>", "hostedUI": "[\"clientId\": \"6num****35nf\", \"clientSecret\": \"(nil)\", \"oauth\": \"[\\\"domain\\\": \\\"rada****.com\\\", \\\"signInRedirectURI\\\": \\\"rada***s://\\\", \\\"signOutRedirectURI\\\": \\\"rada***s://\\\"]\"]", "pinpointAppId": "(nil)", "endpoint": "N/A"]), identityPoolConfigData: Optional(["region": "<REDACTED>", "poolId": "us-w****9f49"]), authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["endpoint": "N/A", "poolId": "us-w****54x6", "pinpointAppId": "(nil)", "region": "<REDACTED>", "clientSecret": "(nil)", "clientId": "6num****35nf", "hostedUI": "[\"oauth\": \"[\\\"signInRedirectURI\\\": \\\"rada***s://\\\", \\\"domain\\\": \\\"rada****.com\\\", \\\"signOutRedirectURI\\\": \\\"rada***s://\\\"]\", \"clientId\": \"6num****35nf\", \"clientSecret\": \"(nil)\"]"], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "<REDACTED>", gHexValue: "2"))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["clientId": "6num****35nf", "poolId": "us-w****54x6", "clientSecret": "(nil)", "region": "<REDACTED>", "hostedUI": "[\"clientId\": \"6num****35nf\", \"clientSecret\": \"(nil)\", \"oauth\": \"[\\\"domain\\\": \\\"rada****.com\\\", \\\"signInRedirectURI\\\": \\\"rada***s://\\\", \\\"signOutRedirectURI\\\": \\\"rada***s://\\\"]\"]", "pinpointAppId": "(nil)", "endpoint": "N/A"], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: Optional(AWSCognitoAuthPlugin.BasicHostedUIEnvironment(configuration: ["clientId": "6num****35nf", "clientSecret": "(nil)", "oauth": "[\"domain\": \"rada****.com\", \"signInRedirectURI\": \"rada***s://\", \"signOutRedirectURI\": \"rada***s://\"]"], hostedUISessionFactory: (Function), urlSessionFactory: (Function), randomStringFactory: (Function))))), authorizationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthorizationEnvironment(identityPoolConfiguration: ["region": "<REDACTED>", "poolId": "us-w****9f49"], cognitoIdentityFactory: (Function), eventIDFactory: (Function))), credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.OSLogWrapper)
2022-12-30 14:05:47.974516-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IntializeSignInFlow.swift Sending event SignInEvent.initiateCustomSignInWithSRP
2022-12-30 14:05:47.975745-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/StartSRPFlow.swift Start execution
2022-12-30 14:05:47.975754-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/StartSRPFlow.swift Sending event SignInEvent.initiateSignInWithSRP
2022-12-30 14:05:47.975779-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.signingInWithSRPCustom" = {
SRPSignInStaet = {
"SRPSignInState.notStarted" = {
};
};
};
};
"AuthorizationState.signingIn" = {
};
};
}
2022-12-30 14:05:47.975862-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution
2022-12-30 14:05:47.977267-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.signingInWithSRPCustom" = {
SRPSignInStaet = {
"SRPSignInState.initiatingSRPA" = {
clientMetadata = {
};
password = "(nil)";
signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.customWithSRP)";
username = "+1********58";
};
};
};
};
"AuthorizationState.signingIn" = {
};
};
}
2022-12-30 14:05:47.979477-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
2022-12-30 14:05:47.979484-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] Credential Store state change:
loadingStoredCredentials
2022-12-30 14:05:47.979496-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "<REDACTED>")
2022-12-30 14:05:47.981078-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError
2022-12-30 14:05:47.981099-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
2022-12-30 14:05:47.981105-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
2022-12-30 14:05:47.981118-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Credential Store state change:
error(KeychainStoreError: Unable to find the keychain item
Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at:
file: /Users/patrickjohnson/Library/Developer/Xcode/DerivedData/radarios-dknagqfhvptgcvcevboslsbwdhqv/SourcePackages/checkouts/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift
function: recoverySuggestion
line: 69)
2022-12-30 14:05:47.981130-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Credential Store state change:
idle
2022-12-30 14:05:47.981134-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
2022-12-30 14:05:47.981139-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Credential Store state change:
loadingStoredCredentials
2022-12-30 14:05:47.981147-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "+14053651058")
2022-12-30 14:05:47.982697-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.completedOperation
2022-12-30 14:05:47.982719-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution
2022-12-30 14:05:47.982725-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState
2022-12-30 14:05:47.983648-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] Credential Store state change:
success(AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId("<REDACTED>", "<REDACTED>"))
2022-12-30 14:05:47.983665-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] Credential Store state change:
idle
2022-12-30 14:05:47.985732-0800 radarios[6472:2019045] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution
2022-12-30T14:05:47-0800 info CognitoIdentityProviderClient : [Logging] Request: POST https:443
Path: /
Host: cognito-idp.us-west-2.amazonaws.com,
User-Agent: aws-sdk-swift/1.0 api/cognito-identity-provider/1.0 os/iOS/16.2.0 lang/swift/5.7 lib/amplify-ios/2.2.1,
X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth,
Content-Type: application/x-amz-json-1.1,
x-amz-user-agent: aws-sdk-swift/1.0,
Content-Length: 6632
Optional([])
2022-12-30T14:05:47-0800 info SerialExecutor : [Logging] Creating connection pool for Optional("https://cognito-idp.us-west-2.amazonaws.com/?")with max connections: 50
2022-12-30T14:05:48-0800 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https://cognito-idp.us-west-2.amazonaws.com/?")
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] headers were received
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] headers were received
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] headers were received
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] headers were received
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] headers were received
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] header block is done
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] incoming data
2022-12-30T14:05:49-0800 info CRTClientEngine : [Logging] stream completed
2022-12-30 14:05:49.340789-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitiateAuthSRP.swift InitiateAuth response success
2022-12-30T14:05:49-0800 info SerialExecutor : [Logging] Connection to endpoint: Optional("https://cognito-idp.us-west-2.amazonaws.com/?") is closing
2022-12-30 14:05:49.351703-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitiateAuthSRP.swift Sending event SignInEvent(data: nil, id: "703A1D8E-2560-4A03-B144-CB387B13DFA5", eventType: AWSCognitoAuthPlugin.SignInEvent.EventType.receivedChallenge(AWSCognitoAuthPlugin.RespondToAuthChallenge(challenge: AWSCognitoIdentityProvider.CognitoIdentityProviderClientTypes.ChallengeNameType.customChallenge, username: "<REDACTED>", session: Optional("<REDACTED>"), parameters: Optional(["USERNAME": "<REDACTED>"]))), time: nil)
2022-12-30 14:05:49.352453-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitializeResolveChallenge.swift Starting execution
2022-12-30 14:05:49.352603-0800 radarios[6472:2019048] [AWSCognitoAuthPlugin] AWSCognitoAuthPlugin/InitializeResolveChallenge.swift Sending event SignInChallengeEvent.waitForAnswer
GGGG confirmSignInWithCustomChallenge2022-12-30 14:05:49.355480-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.resolvingChallenge" = {
"SignInChallengeState.notStarted" = {
};
challengeType = "AWSCognitoAuthPlugin.AuthChallengeType.customChallenge";
signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.customWithSRP)";
};
};
"AuthorizationState.signingIn" = {
};
};
}
2022-12-30 14:05:49.356672-0800 radarios[6472:2019042] [AWSCognitoAuthPlugin] Auth state change:
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.resolvingChallenge" = {
"SignInChallengeState.waitingForAnswer" = {
challenge = "AWSCognitoIdentityProvider.CognitoIdentityProviderClientTypes.ChallengeNameType.customChallenge";
username = "45********************************b0";
};
challengeType = "AWSCognitoAuthPlugin.AuthChallengeType.customChallenge";
signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.customWithSRP)";
};
};
"AuthorizationState.signingIn" = {
};
};
}
Confirming user... 895533
After this last log (which includes the OTP I am sending back), there are no more logs for any other operation I try to perform with Amplify.Auth. Any fetchAuthSession calls, sign in calls, everything is just unresponsive.
Thank you for the patience while we try to narrow down the root cause of this issue. We are still trying to reproduce this behavior, from my testing this is what I found:
Here is my branch royjit.fixfetchAuthSession
that I am currently working on to fix this, and the PR https://github.com/aws-amplify/amplify-swift/pull/2653. Will you able to try the signIn flow with this branch?
For custom auth I used the following define auth lambda trigger:
And my logs are here:
Hey Jithin, I wasn't able to get any more logs for this flow, but I am still facing this issue. I saw that the PR you made above has been stalled due to some unintended consequences of the changes. Do you have any updates on this?
In a last ditch effort to fix this issue, I removed amplify entirely from my project locally and remotely and recreated every resource from scratch. Even still, the issue persists. I am losing hope.
Thanks, for reaching back. I will give an update today here.
Created another PR to address this issue - https://github.com/aws-amplify/amplify-swift/pull/2687
We are currently reviewing PR and testing the changes. Feel free to try out the changes by pointing to the branch royjit.fixfetchAuthSession2
and let us know if this fixes your issue.
In my experience setting CUSTOM_AUTH in the config is not sufficient, even if the docs say otherwise (they often incorrectly refer to SDK v1 APIs). Adding auth options to the signIn call works though: let result = try await Amplify.Auth.signIn(username: username, options: AuthSignInRequest.Options(pluginOptions: AWSAuthSignInOptions(authFlowType: .customWithoutSRP)))
Hey Harold - yes I have that exact line in my sign in function. I have been following this documentation almost to the tee (except for changing out the random number generation logic in the lambda).
Created another PR to address this issue - #2687 We are currently reviewing PR and testing the changes. Feel free to try out the changes by pointing to the branch
royjit.fixfetchAuthSession2
and let us know if this fixes your issue.
I pulled in this branch and I am still facing the same issue. Just to reiterate, the app starts to hang when the confirm sign in call is made.
I am unable to figure out the root cause of this and also not able to reproduce it I followed the same doc. For custom auth I just used a hard coded value. Would you like to setup a call to debug this? You can reach us via discord or contact via email (royji at amazon.com).
Just to circle back here - by pulling in the main branch of the amplify sdk I was able to resolve this issue. Thank you Jithin for deep diving this issue with me and your support throughout this ticket.
Thank you for the update, the changes will be available in the next release.
Need this in the visionos-preview branch. Facing the same error.
@gurkarangulati Can you please open a new issue so that we can track and work on the issue.
Describe the bug
Confirming SMS code is not working when using
CUSTOM_AUTH
asauthenticationFlowType
.Not working on 2.2.0 - working on 1.28.3 (it would be nice to have 2.0.0 because of async await)
Steps To Reproduce
This is our use case:
try await Amplify.Auth.signUp(username: username, password: password, options: options)
Our awsConfig: