Comments (16)
Yes, it returns a challengeName
, search challenge
in this repo.
from amazon-cognito-identity-dart-2.
I mean check it once the user is already logged in.
In my case, I am making a settings screen, where there is an option to activate 2MFA, so that's why I need to check it.
from amazon-cognito-identity-dart-2.
So, in the login process, you already know if the user enters the MFA codes or not.
Based on this data you can determine if 2MFA is activated, correct?
from amazon-cognito-identity-dart-2.
Normally yes, but what if the user is logged in in multiple devices, and in one of them disables/enables 2MFA? That would not update on all devices.
from amazon-cognito-identity-dart-2.
I think you should keep this value in your DB then.
from amazon-cognito-identity-dart-2.
That's a bad practice.
from amazon-cognito-identity-dart-2.
@lain-ke
please add this code into your flutter/.pub-cache-hosted/pub.dartlang.org/amazon-cognito-identity-dart-2-0.1.9/lib/src/cognito_user.dart
and build the app.
Try to call this method. If it works I'll publish a new version.
In my case I don't have the key MFAOptions
in the response, but I suppose this is adjustable in the AWS admin panel.
/// This is used by an authenticated user to get the MFAOptions
Future<List> getMFAOptions(callback) async {
if (!(_signInUserSession != null && _signInUserSession.isValid())) {
throw Exception('User is not authenticated');
}
final paramsReq = {
'AccessToken': _signInUserSession.getAccessToken().getJwtToken(),
};
final userData = await client.request('GetUser', paramsReq);
print(userData);
return userData['MFAOptions'];
}
from amazon-cognito-identity-dart-2.
Hello, I also don't have the MFAOptions key parameter, is there any way to enable it?
from amazon-cognito-identity-dart-2.
Yeap, in this case, it works:
await cognitoManager.cognitoUser.enableMfa();
var mfaOptions = await cognitoManager.cognitoUser.getMFAOptions();
print(mfaOptions);
from amazon-cognito-identity-dart-2.
@lain-ke do you have any feedback? Is this code is useful?
from amazon-cognito-identity-dart-2.
I'll appreciate it if you'd tell me how to use '.getMFAOptions()' method.
The sample code furaiev showed above contains 'cognitoManager', but it doesn't work.
(Actually, my AndroidStudio says 'IT'S UNDEFINED NAME!' , so I can't complete compiling.)
I've looked up about cognitoManager in the documentation for hundred times, but I couldn't find about that.
How do I compose cognitoManager, or, how do I use '.getMFAOptions()'?
from amazon-cognito-identity-dart-2.
@ShogoTsuchiya cognitoManager
is a custom class that keeps CognitoUserPool and CognitoUser.
You can create and use directly CognitoUser.
from amazon-cognito-identity-dart-2.
Thank you for your reply. I tried direct use like this.
await cognitoUser.getMFAOptions();
but it always returns NULL...
from amazon-cognito-identity-dart-2.
it means that server returns userData
without MFAOptions
from amazon-cognito-identity-dart-2.
Thanks!
You mean I can get MFAOptions info as a part of attributes, like 'sub' and 'email_verified' ?
from amazon-cognito-identity-dart-2.
Looks like the MFA options are in userData['UserMFASettingList']
, so the current implementation of cognitoUser.getMFAOptions()
will always return null.
from amazon-cognito-identity-dart-2.
Related Issues (20)
- zip file broken HOT 2
- use case 19 HOT 2
- Unauthorized/Anonymus user token HOT 2
- Forgot Password HOT 2
- Melos version bump? HOT 5
- [ASK] Is it possible to getSession with only `refreshToken` value ? HOT 2
- Use case 19 HOT 3
- CognitoUserDeviceConfirmationNecessaryException is not being thrown HOT 3
- Enabling TOTP for MFA HOT 5
- how to solve custom challenge? HOT 3
- Federated Login... Refresh Access Token HOT 2
- AuthenticationDetails.validationData not transmitted HOT 5
- VerifyDevice request fails if username used in sendMFA() is email or phone number HOT 2
- MFA_SETUP challenge when user pool has "required MFA" HOT 3
- sendMFACode method requires SECRET_HASH HOT 2
- How to verify Password Only without session? HOT 2
- "Missing required parameter Session" while MFA is required HOT 6
- Mismatched key prefix when caching and restoring device HOT 7
- Issue when UserConfirmationNecessary is true HOT 2
- User not autenticated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-cognito-identity-dart-2.