Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Subscription ID -OR- token not available (Chrome) #1104

Closed
eightyfive opened this issue Aug 30, 2023 · 6 comments
Closed

[Question]: Subscription ID -OR- token not available (Chrome) #1104

eightyfive opened this issue Aug 30, 2023 · 6 comments

Comments

@eightyfive
Copy link

eightyfive commented Aug 30, 2023

How can we help?

I subscribe to User.PushSubscription.addEventListener and I allow the notifications.

  • On one Chrome browser: ev.current.token: undefined (while id is available)
  • On another Chrome browser: ev.current.id: undefined (while token is available)

Why is that?

More generally when to use id vs token? I can see that to create a Notification via API I need to pass the subscription id to include_subscription_ids... So what's token for?

Thank you in advance 🙏

@eightyfive
Copy link
Author

By the way, when no id is available, this causes a Web SDK error:

ExecutorBase.js:93 n: processSubscriptionModel: missing onesignalId: {"subscribers":{},"modelName":"pushSubscriptions","modelId":"<REDACTED>","data":{"type":"ChromePush","token":"https://fcm.googleapis.com/fcm/send/<REDACTED>","enabled":true,"notification_types":1,"sdk":"160001","device_model":"MacIntel","device_os":87,"web_auth":"<REDACTED>","web_p256":"<REDACTED>"},"awaitOneSignalIdAvailable":{}}
    at on (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=160001:1:241091)
    at fn.<anonymous> (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=160001:1:243504)
    at Generator.next (<anonymous>)
    at https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=160001:1:326124
    at new Promise (<anonymous>)
    at o (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=160001:1:325869)
    at fn.updateSubscription [as _executeUpdate] (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=160001:1:243383)
    at fn.<anonymous> (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=160001:1:249980)
    at Generator.next (<anonymous>)
    at r (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.es6.js?v=

@jkasten2
Copy link
Member

@eightyfive id might be undefined if the browser hasn't registered with OneSignal yet. token is the push token the bowser gives the SDK, once this is available the SDK will automatically register with OneSignal's backend where it will get an id.

The token isn't something most workflows will need, if you are looking to send notifications you only need to use the id with include_subscription_ids as you noted. The token is only useful for debugging or doing something with it outside of OneSignal.

Can you provide details on reproducing the processSubscriptionModel: missing onesignalId error you are seeing?

@eightyfive
Copy link
Author

Unfortunately I moved away from this lib due to time constraints. As far as I remember the id was never picked up (even with listener).

@nmpco1209
Copy link

hello, I have the same issue on old applications.

image

But it works if I create new application

@tanikatech
Copy link

@nmpco1209

I am having the same exact issue, any solutions if you have found so far ?

@nmpco1209
Copy link

hello @tanikatech
I have temp solution:
Open Keys and IDs then turn off Identity Verification for email + external_id (recommended).
it seems that we have to wait for Web SDK release.

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants