Notification token isn't saved

Please provide the following:

  1. SDK Version: 40
  2. Platforms(Android/iOS/web/all): all
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

When the app gets started an async function runs to get and save the notification token. When explicitly blocking notifications, I get an alert (which is good, this tells me the function runs) But when I allow notifications the following needs to be executed:

token = await Notifications.getExpoPushTokenAsync();

      fetch('', {
        method: 'POST',
        headers: {
          Accept: 'application/json',
          'Content-Type': 'application/json',
        body: JSON.stringify({
          token: {
            value: token,
    }).then((response) => response.text())
    .then((responseData) => {

and on that PHP page the only thing that happens is the following:

$json = json_decode(file_get_contents('php://input'), true);

$token = $json['token']['value'];

   $sth = $db->prepare('INSERT INTO pushnotificationusers (uid) VALUES (:uid)');
   $sth->execute(array(':uid' => $token));

but this doesn’t work. The token isn’t saved. This is both on Android and iOS.
I have Firebase setup and added both Apple’s key and Firebase’s key in Expo.

I really really hope some can help me. Thanks a lot in advance!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.