# FCM getToken() returns empty string

**URL:** <https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322>\
**Category:** Ionic Native\
**Created:** [August 17, 2017, 11:41am UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322 "2017-08-17T11:41:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![reuvenh](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@reuvenh](https://forum.ionicframework.com/u/reuvenh)\
**Post date:** [August 17, 2017, 11:41am UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/1 "2017-08-17T11:41:38Z")

</div>

Hello,  
I’m Using ionic-native fcm for notifications.  
When doing getToken() i’m getting back empty string and the onTokenRefresh() never gets called…  
these are my methods:

```auto
this.fcm.getToken().then(token => {
      alert('token id: ' + token);      
    })

    this.fcm.onTokenRefresh().subscribe(token => {
      alert('token id onTokenRefresh: ' + token);
    })

```

What am i missing?

Thanks!

---

<div class="post-metadata">

**Author:** ![prashant454](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@prashant454](https://forum.ionicframework.com/u/prashant454)\
**Post date:** [August 17, 2017, 12:12pm UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/2 "2017-08-17T12:12:16Z")

</div>

have you installed plugin and native/fcm correctly?

and check whaether you added google-services.json into project folder and everthing in it correct eg package name matching,api key etc

---

<div class="post-metadata">

**Author:** ![reuvenh](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@reuvenh](https://forum.ionicframework.com/u/reuvenh)\
**Post date:** [August 17, 2017, 12:20pm UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/3 "2017-08-17T12:20:06Z")

</div>

> installed plugin and native/fcm correctly?  
> yes, as instructed in the official docs.

> google-services.json  
> yes

> package name matching,api key  
> yes

What else can cause this?

---

<div class="post-metadata">

**Author:** ![prashant454](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@prashant454](https://forum.ionicframework.com/u/prashant454)\
**Post date:** [August 17, 2017, 1:08pm UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/4 "2017-08-17T13:08:06Z")

</div>

uninstall app and try running

cordova run android --prod

sometimes it wont take changes made --prod will make it happen

---

<div class="post-metadata">

**Author:** ![reuvenh](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@reuvenh](https://forum.ionicframework.com/u/reuvenh)\
**Post date:** [August 17, 2017, 3:13pm UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/5 "2017-08-17T15:13:45Z")

</div>

well good news, now i’m getting null (-:  
so this has to do with the fact that the onTokenRefresh doesn’t fire?

---

<div class="post-metadata">

**Author:** ![jmlozano](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jmlozano](https://forum.ionicframework.com/u/jmlozano)\
**Post date:** [October 11, 2017, 11:17am UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/6 "2017-10-11T11:17:34Z")

</div>

Hello,  
I have the same problem. Have you been able to solve it?

---

<div class="post-metadata">

**Author:** ![carlosadrian](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/carlosadrian/32/100555_2.png) [@carlosadrian](https://forum.ionicframework.com/u/carlosadrian)\
**Post date:** [January 13, 2018, 12:35pm UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/7 "2018-01-13T12:35:17Z")

</div>

Same problem here. Any news?

---

<div class="post-metadata">

**Author:** ![yashwanth493](https://avatars.discourse-cdn.com/v4/letter/y/a183cd/32.png) [@yashwanth493](https://forum.ionicframework.com/u/yashwanth493)\
**Post date:** [January 13, 2018, 6:13pm UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/8 "2018-01-13T18:13:34Z")

</div>

for testing purpose create an project in FCM and try to establish connection with FCM.  
If it is working fine then u could change your FCM server key with the new one.

---

<div class="post-metadata">

**Author:** ![reuvenh](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@reuvenh](https://forum.ionicframework.com/u/reuvenh)\
**Post date:** [January 13, 2018, 6:31pm UTC](https://forum.ionicframework.com/t/fcm-gettoken-returns-empty-string/102322/9 "2018-01-13T18:31:14Z")

</div>

yes, dropped FCM , working with ionic native push
