-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile SignIn function failure from @aws-amplify/auth but WebVersion works (using Expo) #13964
Comments
Hello, @ajaviles13 and thanks for opening this issue. Given that there's no information in the error message to help us here, we might need to get some additional info from the network requests when this error happens. Can you share a screenshot or the details of what your responses are from Cognito when this happens? Here's a link to the RN docs to help with the network logging. We know that getting the logs is tough sometimes in React Native, so if you're open to sharing a minimal sample app that reproduces this reliably then that would be great as well. |
@ajaviles13, have one more request after digging into your dependencies. It looks like you've got the following outdated dependencies:
Can you see if removing these and only having the |
Hi @cwomack, thanks for getting back to me. I tried the following:
I am happy to share my React Native project folder. I filled in any account sensitive info with "#" plus this is an MVP app where I am seeing if I will be using AWS Auth for Authentication. What is the best way for me to provide you with a zip file of my App Project Folder? I'll also provide more information on the general folder structure of my app as well. |
@ajaviles13, best way to share it (if you're open to it) would be to make the repo public if you remove any sensitive information that might be on it, invite me to the private repo if you'd like, or hop on our AWS Amplify Discord server and you we can follow up there as well with a DM. |
@cwomack - great. I removed sensitive information and shared everything but my "node_modules" folder in a public repo here: [aws-auth-error](https://github.com/ajaviles13/aws-auth-error.git). Take a look at the README file before diving in. This isn't a time sensitive matter because I have a functional workaround using Appwrite for my Auth workflow and webhooks to sync new users/data created upon sign up directly into my AWS infrastructure. But I would love to have my Auth workflow within AWS. |
@cwomack - I wonder if it has something to do with CORS. I am not an expert at CORS but watched a couple videos and may be thinking it is correlated with my AWS Auth workflow failing to auto sign in and sign in as well. Edited: Never mind, CORS only affects web browsing and not Mobile Apps |
@ajaviles13, thank you for the sample repo! Few more questions to better understand the architecture here as I haven't used Appwrite personally and am just digging into their docs. Are you only trying to incorporate the Auth category then from Amplify via one of the "Auth Journeys" mentioned by Appwrite? Additionally, I see you're wrapping your Auth API's and using |
Hi @cwomack, thanks for the reply. Let's forget I even mentioned Appwrite, all that implementation was stripped out of the repo that I uploaded earlier. Goal here is to get AWS Amplify Auth working as expected. After attempting the "wrapping Auth API" suggestion you made I am still getting these issues (I also added a Loom Recording below):
Please see this Loom recording of the issues I am facing: I also updated the "amplify.js", "confirmCodeUponSignUp.jsx", and "signUp.jsx" in aws-auth-error based on the V6 documentation which is still leading me to the errors defined above. Let me know if there is anything else I can provide that will be helpful. |
@ajaviles13 Thanks for the very detailed video and explaining through your workflow. Really appreciate this. Looking at the code in the video i noticed couple of things and gonna try and help based on the observation there.
Meanwhile, we will work on reproducing the error in a fresh RN app to see if we can isolated it to some setup. |
Also could you confirm if you have followed this getting started guide? Or added all the dependencies mentioned here for your RN app with exception of |
Hi @ashika112. Thanks for jumping in here. To answer you questions:
|
Hi @ajaviles13 I can confirm autoSignIn works as expected in react native. I created a fresh sample app with signup, confirmsignup, autosignIn and everything works as expected. My doubt would the way in which the code is called and executed might be what is causing u the issue. It might some race condition happening in your code base. |
my code is as simple as,
|
@ashika112 - thank you for sharing your findings and glad to hear you got it working. I am performing a deeper analysis on my code base. I've been able to implement both Appwrite and Supabase Auth (used in different app files but same code base) perfectly with the same unplug/plugin approach in my code base. I'll need to dig deeper why my codebase isn't working with AWS Auth. Thanks again |
@ajaviles13, wanted to circle back and see if you had a chance to dig into the codebase and find the root cause. Let us know if you're still needing help on this! |
Hi @cwomack, I haven't had a chance to dig deeper. I have my current Auth workflow working great with Supabase at the moment and I am heads down in other FE/BE dev priorities in order to launch an MVP app within the next month. I'm a one man band at the moment so I'll circle back to the AWS Auth implementation in late December once my MVP is out there with my beta users. |
@ajaviles13, completely understand and take your time! We'll update the labels to be pending your response until you get some bandwidth to dig deeper and keep the issue open. Feel free to reply back whenever you get a chance in December, and good luck! |
Sounds good and will do. Thanks @cwomack ! |
@ajaviles13, wanted to check in and see if you had the time to dig deeper on this. |
Hi @cwomack , thanks for following up. I haven't had time to dig deeper into the Amplify implementation. I did spend some time just creating a one-off User Pool in AWS Cognito and copy/pasting my userPoolID and clientID directly into my app and the workflow worked for signing up and signing in. I confirm my email with a 6-digit code and I get redirected to my home page as expected. If I sign out, I can sign back in since I verified my email with the 6-digit code. However, my Authentication Creds don't persist if I refresh my app. On refresh, my app will always send me back to the login screen. I am using AsyncStorage to store the auth tokens upon creating an account and I can see them when doing so but then I refresh the app, they go poof and don't return. |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify CLI
Environment information
Describe the bug
I am integrating all the "aws-amplify/auth" functions into my custom UI. I've already successfully integrated the {signUp, signOut, confirmSignUp, resendSignUp } functions and they work great. No errors and my account I create (using email as username) goes right into my Cognito Pool smoothly which was set up through AWS Amplify Studio. Logout button works great when I get to my "Home" screen after Signing Up and Confirming my 6-digit Code. This is the return value I get by overlaying my 'confirmSignUp' and 'signUp' responses and storing them in a global app variable called "user":
'newSetUser': {"isSignUpComplete": true, "nextStep": {"codeDeliveryDetails": {"attributeName": "email", "deliveryMedium": "EMAIL", "destination": "a***@g***"}, "signUpStep": "DONE"}, "userId": "c14b75c0-70b1-7048-9c0b-07ba8df12052"}
The problem is after I log out... I try to Sign In using my custom Sign In UI screen that is connected to the {signIn} function from "aws-amplify/auth". When clicking "Sign In", I get this bizarre error that I cannot figure out what is going on. I can clearly see my username (email) and password get passed into the 'signIn' function correctly and they are the same creds I used upon set up (I've validated this over and over again). This is the error message:
"Error during sign in: [Unknown: An unknown error has occurred.]"
Expected behavior
For me to simply sign in with the correct credentials with no errors. I've watched and followed several YouTube videos and thread approaches to this simply "signIn" function within "aws-amplify/auth" but I always come back to get this unknown error message...
Reproduction steps
Code Snippet
Log output
aws-exports.js
/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = {
"aws_project_region": "us-east-2",
"aws_cognito_identity_pool_id": "us-east-2:#########-####-####-####-###########",
"aws_cognito_region": "us-east-2",
"aws_user_pools_id": "us-east-2_##########",
"aws_user_pools_web_client_id": "#########################",
"oauth": {},
"aws_cognito_username_attributes": [
"EMAIL"
],
"aws_cognito_social_providers": [],
"aws_cognito_signup_attributes": [
"EMAIL"
],
"aws_cognito_mfa_configuration": "OFF",
"aws_cognito_mfa_types": [
"SMS"
],
"aws_cognito_password_protection_settings": {
"passwordPolicyMinLength": 6,
"passwordPolicyCharacters": []
},
"aws_cognito_verification_mechanisms": [
"EMAIL"
]
};
export default awsmobile;
Manual configuration
No response
Additional configuration
No response
Mobile Device
iPhone 15 Pro
Mobile Operating System
iOS18.0.1
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
Using Expo
The text was updated successfully, but these errors were encountered: