pusher / push-notifications-android

Android SDK for Pusher Beams
https://www.pusher.com/beams
MIT License
21 stars 21 forks source link

PushNotificationsAPI: Failed to register device: NOKResponse(error=Unauthorized, description=The device token provided could not be validated against any known credentials) #107

Open mona-baharlou opened 4 years ago

mona-baharlou commented 4 years ago

My Pusher Beams has worked fine for 3 months, but today I got this error, and there is no document about how can I resolve this error.

"PushNotificationsAPI: Failed to register device: NOKResponse(error=Unauthorized, description=The device token provided could not be validated against any known credentials)"

MohsenSameti commented 4 years ago

any news on this? this is happeing to me too, till last week it was working, but now i get this error.

daniellevass commented 3 years ago

Hi,

The error can be triggered for a number of reasons. We're using Google's api from https://developers.google.com/instance-id/reference to check the device token (which you can also curl yourself to confirm).

I'd recommend checking the following:

If you're still seeing issues - we'd appreciate some more information on what's happening. Do you have any steps to reproduce?

Thank you,

JonnyHov commented 3 years ago

I have been having this same error happen to my Android application. It will work for a while and then it will stop connecting to push notifications with the same error message. I have to clear the app data in order for it to start working properly. It is not a consistent error; it has only happened a couple of times.

mfreeman451 commented 2 years ago

We are having the same issues. We can call PusherBeams.instance.start('') (flutter client) fine with no errors, we can also subscribe to a device interest, with no errors. However we keep seeing these messages in our logs:

W/PushNotificationsAPI( 1979): Failed to register device: NOKResponse(error=Unauthorized, description=The device token provided could not be validated against any known credentials)

This is happening on Android devices for us, will test IOS next

Please advise

mfreeman451 commented 2 years ago

We did configure Safari APN stuff last night, this is possibly related. Going to try removing the Safari configuration.

mfreeman451 commented 2 years ago

We did configure Safari APN stuff last night, this is possibly related. Going to try removing the Safari configuration.

No change

kimonneuhoff commented 2 years ago

I have the same error. Is there a fix yet?

guruz commented 2 years ago

Got the same issue when playing around with different brandings (using different package name in AndroidManifest.xml).

Not sure what causes it. There is a Stackoverflow with similar: https://github.com/pusher/push-notifications-android/issues/107

EDIT: Maybe it's somehow related to DeviceStateStore and deviceId. It uses a getSharedPreferences, so when I played around with same app with different package ID before then it somehow collides(? no idea)

https://github.com/pusher/push-notifications-android/blob/abd5a8b5c5b1c702d75dae24b2594f7847d1b5ed/pushnotifications/src/main/java/com/pusher/pushnotifications/internal/DeviceStateStore.kt#L9

guruz commented 2 years ago

Seems to work now after deleting the app on the phone AND deleting the build dir completely.

I also see this in the log then when launching, probably related:

MessagingService: Got new or refreshed FCM token: (...)
fabiorbap commented 9 months ago

I'm still getting it using

implementation 'com.pusher:push-notifications-android:1.8.0'
implementation 'com.pusher:pusher-java-client:2.2.1'

Any news on how to solve it? I can't ask users to clear their data to solve this