-
Notifications
You must be signed in to change notification settings - Fork 249
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
[Feature Request] Custom Auth Flow #410
Comments
@athirasubair Are you using the Cognito Custom Auth Challenge triggers as described here? |
@haverchuck Yes we are using the same. |
do we have any update on this ? when we change authenticationFlowType to CUSTOM_AUTH it basically throws the error saying username/password is incorrect. is the Custom_Auth even supported in flutter ? I've also followed this amplify android link https://docs.amplify.aws/sdk/auth/custom-auth-flow/q/platform/android#custom-authentication-in-amplify it says that
here what do they mean by dummy password. |
Hi! We're experiencing the same. We've setup the lambda triggers as mentioned in the Docs and have updated it our However, it seems like the user always fails to sign in when we use this and we had to then switch back to |
any updates? |
Hi, Any update on this? |
Hi, I had implemented CUSTOM_AUTH flow for my web app because it is relevant for my use case. Finally we decide to create an android/ios app using flutter, we are almost done, only to find that this flow is not supported yet. Any update? or an alternative while this is implemented?. |
Hallo Universe, while we wait, here is the manual implementation of custom authentication flow in flutter using Cognito cli REST API, import 'dart:convert';
import 'package:http/http.dart' as http;
// Trigger Create Auth Challenge, returns Session Token, etc.
Future<Response> loginWithCustomAuthFlow(String username) async {
var url = Uri.parse('https://cognito-idp.{YOUR_AWS_REGION}.amazonaws.com/');
Map<String, dynamic> data = {
'AuthParameters': { 'USERNAME': username },
'AuthFlow' : 'CUSTOM_AUTH',
'ClientId' : '{YOUR_COGNITO_CLIENT_ID}'
};
Map<String,String> headers = {
'Content-Type':'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.InitiateAuth'
};
return http.post(url, headers: headers, body: jsonEncode(data));
}
// Trigger Verify Auth Challenge, returns AuthenticationResult (AccessToken, RefreshToken) etc
Future<Response> respondToAuthChallenge(String username, String otp, String sessionToken) async {
var url = Uri.parse('https://cognito-idp.{YOUR_AWS_REGION}.amazonaws.com/');
Map<String, dynamic> data = {
'ChallengeResponses': { 'USERNAME': username, 'ANSWER': otp },
'ChallengeName' : 'CUSTOM_CHALLENGE',
'ClientId' : '{YOUR_COGNITO_CLIENT_ID}',
'Session': sessionToken
};
Map<String,String> headers = {
'Content-Type':'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.RespondToAuthChallenge'
};
return http.post(url, headers: headers, body: jsonEncode(data));
} |
Hi, https://docs.amplify.aws/lib/auth/signin_with_custom_flow/q/platform/android/ says: Android is not supported on this page. Please select one of the following: does that mean we can't implement a custom sign-in flow out of the box with amplify? |
Hi! We are still having problem with confirmSignIn: underlyingException:"java.lang.IllegalStateException: confirmSignIn called after signIn has succeeded" Using javascript => Auth.sendCustomChallengeAnswer(this.auth.user, this.token) function works perfectly. Already using confirmSignIn gives this error. Can anyone help us? |
@juanrequeijo - custom auth is currently still unsupported. However, it has been prioritized for a future release. There are currently no workarounds at the moment outside of the ones mentioned in this thread. |
If I authenticate the user with Cognito REST API, can I still use amplify client library to handle other API calls? |
Hi, @Simon-PumpAndUp, maybe this might help, here is a link to a guide on how to setup backend for phone/sms password-less authentication: https://itnext.io/passwordless-sms-authentication-backend-9932391c49dc |
Yes! Here is how I did this: Create a user using this endpoint. Keep the password. After you verified your user with the OTP, log it out. Then use Amplify.Auth and the password you used for the user and voila. Not sure how to use the admin* endpoints. For when the user logs in and is not creating an account, you have to retrieve the password or create a new one using this endpoint. Not figured it out yet |
Thanks for your patience bringing this feature to Amplify Flutter. It has been released in v0.5.0
|
Hello everyone, Here my amplifyconfiguration, my piece of code is equal to the tutorial example.
|
Hey @dagovalsusa, try replacing with the following: Also make sure to call the signing in method with the option param:
|
I tried replacing And add options param to signIn method (but my password is null because is passwordless)
But not works, the response is
|
Ha nevermind, then your config is ok then using only "CUSTOM_AUTH" I think the bottom line is: a cognito user must have a password |
"authenticationFlowType": "CUSTOM_AUTH"
The text was updated successfully, but these errors were encountered: