Everything was working fine before but now firebase can't seem to create a new token. I'm trying to call await FirebaseMessaging.instance.getToken(); but getting this error
FLTFirebaseMessaging: An error occurred while calling method Messaging#getToken, errorOrNil => {
NSLocalizedFailureReason = "Too many server requests.";
}
[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: [firebase_messaging/unknown] An unknown error has occurred.
#0 MethodChannelFirebaseMessaging.getToken (package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:226:7)
<asynchronous suspension>
#1 _SignUpState._sendVerificationCode (package:shuri_parent/src/pages/sign_up.dart:343:25)
<asynchronous suspension>
#2 _SignUpState.build.<anonymous closure> (package:shuri_parent/src/pages/sign_up.dart:252:43)
<asynchronous suspension>
I'm using firebase_messaging: : ^10.0.9
My application is broken in production, I really need your help guys.
This is my flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.3.0-17.0.pre.121, on Mac OS X 10.15.7 19H1419
darwin-x64, locale en-RW)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.61.0)
[✓] Connected device (2 available)
• No issues found!
Also my app is just recently deployed and doesn't have more than 10 users, other can't seem to use the app due to this blocker. Your help will be much appreciated.
This issue is caused by limited permission to your api key from Google cloud console, here are steps that fixed my issue,
Login to Google cloud console and select your current project
Select **API Credentials - APIs & Services ** or IAM Permissions on left sidebar.
Select iOS key(auto created by firebase)'s menu on right if you have selected **API Credentials - APIs & Services **
Select Edit API key
Under the Selected APIs: dropdown menu select these options:
Firebase Installations API,
Firebase Cloud Messaging API &
FCM Registration API

Oh! my bad, I found the issue. My issue was a wrong api key of firebase in the GoogleServices-info.plist file
Thanks for all the support you gave me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With