authenticateWithQRCode method
Authenticates a user in the MIRACL Trust platform via QR code.
Use this method to authenticate another application using a QR code presented on the MIRACL Trust login page.
Parameters:
user
: The User to authenticate.qrCode
: A string read from the QR code.pin
: The user's PIN.
Throws AuthenticationException if the authentication process fails for any reason (e.g., incorrect PIN, invalid QR code, expired session).
Implementation
Future<void> authenticateWithQRCode(User user, String qrCode, String pin) async {
try {
final mUser = user._toMUser();
await _sdk.authenticateWithQrCode(mUser, qrCode, pin);
} on PlatformException catch(e) {
final exceptionCode = e._getExceptionCode();
if (exceptionCode is MAuthenticationExceptionCode) {
throw AuthenticationException._create(
exceptionCode.toAuthenticationExceptionCode(),
e.details["error"]
);
} else {
rethrow;
}
}
}