OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
603 stars 367 forks source link

[Bug]: Unable to login to any other external id once user_subscription_limit has reached on previous external id #2143

Open mostfinance-ca opened 2 months ago

mostfinance-ca commented 2 months ago

What happened?

Library try to login with previous failed externaId.

What I did?

This loop is infinity.

Steps to reproduce?

- Login with ExternalID that has reached user_subscription_limit
- Call Logout method
- Login with any ExternalID

What did you expect to happen?

I expected the external id to update. Because it works well on iOS!

OneSignal Android SDK version

5.1.17

Android version

13

Specific Android models

No response

Relevant log output

HttpClient: Got Response = POST - STATUS: 409 - Body: {"errors":[{"code":"subscription-1","title":"Operation is not permitted due to user having the maximum number of subscriptions assigned","meta":{"user_subscription_limit":20}}]}

Code of Conduct

jkasten2 commented 1 month ago

@mostfinance-ca Thanks for reaching out. Each time you uninstall and reinstall the app all data is lost for the app. The OneSignal SDK doesn't know this is the same device so a new push subscription is created.

It unlikely a legitimate end-user would do this 20 times, however it possible it could happen. In this case you would have to clean up the older subscriptions by deleting them. This could be done via the OneSignal DELETE /subscriptions REST API if this comes up in the real world.

We are looking into removing older push subscription automatically so this extra integration step won't be needed in the future.

mostfinance-ca commented 1 month ago

@jkasten2

jkasten2 commented 1 month ago

@mostfinance-ca sorry I misunderstood the issue you are seeing, this is bug then. Just to confirm the steps:

  1. Have 20 subscriptions on User with external_id = 'A'
  2. Call OneSignal.login("A")
  3. Observer the expected user_subscription_limit error.
  4. Call OneSignal.login("B")
  5. BUG - Login "B" never happens, push subscription never transfers, due to the SDK continuing to try to login as "A".
mostfinance-ca commented 1 month ago

@jkasten2 That's right, I confirm these steps.