question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

expo-notifications failing to get token

See original GitHub issue

Summary

I am having issues with expo-notifications.

So I created a blank project with the expo init command, created a managed workflow, and installed expo notifications via expo install.

Then I copied the registerForPushNotificationsAsync from here, used it in a useEffect hook and got the following error: [Unhandled promise rejection: Error: Fetching the token failed: java.util.concurrent.ExecutionException: java.io.IOException: AUTHENTICATION_FAILED]

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

45

Environment

expo-env-info 1.0.5 environment info: System: OS: Windows 10 10.0.22000 Binaries: Node: 16.16.0 - C:\Program Files\nodejs\node.EXE npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD npmPackages: expo: ~45.0.0 => 45.0.6 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-web: 0.17.7 => 0.17.7 Expo Workflow: managed

Reproducible demo

https://docs.expo.dev/versions/latest/sdk/notifications/#api

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:11
  • Comments:63 (8 by maintainers)

github_iconTop GitHub Comments

26reactions
s-kuniyoshicommented, Aug 15, 2022

I still keep getting this problem. asap update pleeeese

17reactions
TheRealMikeDcommented, Sep 2, 2022

I found a workaround for this issue. If the problem is that expo-notifications can’t find the projectID, just supply it:

const appConfig = require('../app.json');
const projectId = appConfig?.expo?.extra?.eas?.projectId;
const token = (await Notifications.getExpoPushTokenAsync({
	projectId
})).data;

This is working for me, and will enable me to keep developing and testing my notifications code, although I don’t feel like it should be necessary for production code, and I’m hoping that a proper fix is on the way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push Notifications Troubleshooting & FAQ
The ExpoPushToken will never "expire" but if one of your users uninstalls the app, you'll receive a DeviceNotRegistered error back from Expo's servers,...
Read more >
Can not get expo push token - Stack Overflow
I am building a React native app which is based on Expo , i use Expo's push notification . when i test ...
Read more >
[expo-notifications] Error encountered while updating the ...
I'm trying to set up notifications with bare-work-flow. I initially was able to retrieve my expo push token but when I returned to...
Read more >
Implementing Expo Push Notifications [Step-by-Step Guide]
'granted') { alert('Failed to get push token for push notification!'); return; } token = (await Notifications.getExpoPushTokenAsync()).data ...
Read more >
Adding notifications to your expo app - | Negative Epsilon
return; } // obtain the expo token token = (await Notifications. ... allow us to access to the notifications alert('Failed to get push...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found