I’m working on a flutter project and I’m using email_otp package to send a verification code to the email
myAuth.setConfig(
appEmail: "[email protected]",// used a real email but for email hiding purpose I put this
appName: "Spectrum Speak",
userEmail: _emailController.text,
otpLength: 4,
otpType: OTPType.digitsOnly,
);
bool r = await myAuth.sendOTP();
if (r == true) {
print("done send");
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('OTP has been sent'),
),
);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OTPScreen(
myAuth: myAuth,
email: _emailController.text,
comeFromSignUp: true,
),
),
);
} else {
print("error");
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Oops, OTP send failed'),
),
);
}
So it always returns a false valuem even though it was functioning properly two weeks ago
I have the latest version of email_otp in pubscpec.yaml
, it’s supposed to return a true
value and send the OTP to the email in the _emailController.text
I’d appreciate it if someone would tell me if they faced this and how did they fix it, thank you
2
Answers
Update: Gave up on this package and used a third party api called EmailJS to send OTP verification
Watch this video for more details Video. Make sure to turn on API the 'Allow EmailJS API for non-browser applications.' from the security section in the account tab in Email JS, also you can use API public key for the user_id
Something very similar happened to me, I have the following code that worked perfectly a couple of months ago to send an email with a 4-digit code and today that I was debugging, I realized that it no longer sends the email.
If you find the solution, please share it