How to store fcm token in the users document at the time of create account using Firebase Authentication

Actions & Logic

Thanks for your reply. I am facing an issue, please help me out in it, the scenario is that I have a FlutterFlow project, using Firebase Authentication; while when I create an account using LoginPage I am also storing the fields in the collection document named as "users"  but I am not able to store the fcm_token generated by Firebase in the users document against the field fmc_token (plz ignore the fieldname mistake).

I tried to create the Custom Function to get the FCM token but the function not compiled or save

Custom Function:

Future<String?> getFCM() async {
  final FirebaseMessaging fcm = FirebaseMessaging.instance;
  String token = await fcm.getToken() ?? '';

  return token;
}

I also tried to created the custom action and include the custom action along with the AuthCreateAction on the Create Account button but not succeed. 

Therefore, I need help how to store the fcm token generated at the time of account creation in the users document against the field 'fmc_token'

Thankyou in advance and looking forward to your reply.

What have you tried so far?

Tried to fetch FCM using custom function but not complying or saving

Tried custom action included along with the Auth Create Account action but not able to store the FCM token in the users document

Did you check FlutterFlow's Documentation for this topic?
No
2
2 replies