Skip to content

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

@namdh03

Description

@namdh03

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions