# Ionic-native firebase getToken()

**URL:** <https://forum.ionicframework.com/t/ionic-native-firebase-gettoken/171413>\
**Category:** Ionic Native\
**Created:** [August 19, 2019, 12:56pm UTC](https://forum.ionicframework.com/t/ionic-native-firebase-gettoken/171413 "2019-08-19T12:56:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![altergothen](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/altergothen/32/116770_2.png) [@altergothen](https://forum.ionicframework.com/u/altergothen)\
**Post date:** [August 19, 2019, 12:56pm UTC](https://forum.ionicframework.com/t/ionic-native-firebase-gettoken/171413/1 "2019-08-19T12:56:44Z")

</div>

ionic-native firebase getToken()  
I don’t seem to get any response from getToken at all?  
I even tried triggering it manually with a button.

```auto
...
import { Firebase } from '@ionic-native/firebase/ngx';
...
constructor(public firebaseNative: Firebase),
...
async getToken() {
let token;
token = await this.firebaseNative.getToken();
alert(token);
}

```

I get nothing back, not even an error?

successfully Installed: `ionic cordova plugin add cordova-plugin-firebase`  
successfully Installed: `npm install @ionic-native/firebase`  
I compiled the app on using ionic pro / app flow and installed it on a real Android device, no emulator.

What am I doing wrong please?  
How can I retrieve any error messages that may be being returned by getToken() ?

---

<div class="post-metadata">

**Author:** ![ankit18](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@ankit18](https://forum.ionicframework.com/u/ankit18)\
**Post date:** [December 21, 2020, 3:51pm UTC](https://forum.ionicframework.com/t/ionic-native-firebase-gettoken/171413/2 "2020-12-21T15:51:22Z")

</div>

@altergothen I’m also facing same problem. Can you tell me the if you resolve the issue.

---

<div class="post-metadata">

**Author:** ![TristanGodal](https://avatars.discourse-cdn.com/v4/letter/t/9f8e36/32.png) [@TristanGodal](https://forum.ionicframework.com/u/TristanGodal)\
**Post date:** [December 23, 2020, 11:12am UTC](https://forum.ionicframework.com/t/ionic-native-firebase-gettoken/171413/3 "2020-12-23T11:12:33Z")

</div>

Hi, I was just running on this issue few month ago.

Instead of using @ionic-native dependency, I just achieved it by this way :

App.module.ts :

```auto
import { FCMPluginOnIonic } from "cordova-plugin-fcm-with-dependecy-updated/ionic";

// Add it to providers

```

The class where your instanciate it :

Import :

```auto
import { FCM } from "cordova-plugin-fcm-with-dependecy-updated/ionic";

```

My setup method (Adapt it for yours) :

```auto
  private async setupFCM() {
    await this.platform.ready();
    if (!this.platform.is('cordova')) {
      return;
    }
    FCM.onTokenRefresh().subscribe((newToken) => {
      this.authService.firebaseToken = newToken;
    });
    FCM.onNotification().subscribe((payload) => {
      this.badge.increase(1);
      this.toastCtrl.create({
        header: payload.title,
        message: payload.body,
        position: 'top',
        buttons: [
           {
            role: 'cancel',
            icon: 'close'
          }
        ]
      }).then(toastEl => {
        toastEl.present();
     });         
    });

    this.hasPermission = await FCM.requestPushPermission();
    this.firebaseFCMToken = await FCM.getToken();
    this.authService.firebaseToken = this.firebaseFCMToken;
    this.pushPayload = await FCM.getInitialPushPayload();
  }

```
