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

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

Open
1 task done
mostfinance-ca opened this issue Jul 5, 2024 · 5 comments

Comments

@mostfinance-ca
Copy link

mostfinance-ca commented Jul 5, 2024

What happened?

Library try to login with previous failed externaId.

What I did?

  • OneSignal.login(ExternalID), where ExternalID has reached user_subscription_limit
  • I getting
{
  "errors": [
    {
      "code": "subscription-1",
      "title": "Operation is not permitted due to user having the maximum number of subscriptions assigned",
      "meta": {
        "user_subscription_limit": 20
      }
    }
  ]
}
  • Invoking OneSignal.logout()
  • trying login with any new ExternalId but library don't make api calls
  • restarting application
  • Invoking OneSignal.initWithContext and library make api calls (login) with previous ExternalID

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

  • I agree to follow this project's Code of Conduct
@jkasten2
Copy link
Member

jkasten2 commented Jul 9, 2024

@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.

  • Also FCM gives the app a new pushToken, so even that can't be used to know it is the same device.

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.

  • If this is just a test user you could also simply delete old test subscriptions from the OneSignal dashboard.

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

@mostfinance-ca
Copy link
Author

mostfinance-ca commented Jul 10, 2024

@jkasten2

  • Why does the iOS SDK correctly call API requests, but the Android SDK does not?
  • Android SDK remembers the previous External_ID and tries to repeat the login operation again and again. Even after restarting the application. On iOS, a NEW External_ID is inserted into the request every time when I call OneSignal.login method

@jkasten2
Copy link
Member

@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
Copy link
Author

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

@azapolsky
Copy link

Same problem!!!

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

3 participants