react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

[Question]: How to get FCM token from OneSignal to send notifications via Firebase?

Open namdh03 opened this issue 5 months ago • 0 comments

How can we help?

Hi, I have a question about integrating Firebase Cloud Messaging (FCM) and OneSignal.

Currently, I’m using the library @react-native-firebase/messaging to get an FCM token like this:

try {
  await messaging().registerDeviceForRemoteMessages();
  const token = await messaging().getToken();
  console.log('FCM Token:', token);
} catch (error) {
  console.log('Error getting FCM token:', error);
}

This gives me a token in the format like:

fXZO54XETHei-rgFRInOf8:APA91bG2b9mAlQpqBkl2Qv5wUyJsf6EGOaok8xMT8YMm30USOtocIUlvo4uE-lWFD9XbNOfmQeOR2-0OCku6Wa-vdp0q8MkgxNt6DQyMWra-kzOHhnRb658

My question is:

👉 How can I get a similar FCM token from OneSignal so that I can use Firebase to send notifications directly with that token? In other words, can OneSignal provide me an FCM token like the one above?

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

namdh03 avatar Aug 31 '25 13:08 namdh03