Open muezz opened 10 months ago
@muezz I believe you are correct that the external_id has likely not yet been applied to the user in time. We are working on adding callbacks to various methods such as login that will let you know the server response to those calls to ensure they have completed successfully. Those callbacks should help improve scenarios like this one.
@emawby That would be great. But I am confused. Shouldn't await
ing the login mean that by the time this async
operation is done, the user is logged in? Why is that not the case?
Hi @muezz,
I apologize for the confusion with await
. The await
is actually to send this method call over the native bridge to the corresponding native Android or iOS method that handles login
. It is not for the completion of the server call.
We will be adding a User State observer very soon (sooner than login
callbacks) that you can use to effectively know when the login
call has succeeded on the server.
What happened?
Notification is not created if I try right after calling
login
.Steps to reproduce?
I am using Supabase auth but this should be reproducible without it. Here is my code:
Here is the code that schedules a notification as a new user signs up.
What did you expect to happen?
I expected the notification to be scheduled without any issues but that does not happen. Although sometimes it does work.
My suspicion is that I am calling
login(external_id)
and then trying to set up a notification based on thatexternal_id
right away. But maybe thatexternal_id
takes a bit longer to be added as an alias? I get the following error:{"id":"","errors":{"invalid_aliases":{"external_id":["04a992ac-91f8-40b6-84f6-43d29a745184"]}}}
Right after this, if I go into the Onesignal dashboard and check my subscriptions, the latest user is there with this particular external ID. So if the user exists, why do I get this error?
OneSignal Flutter SDK version
5.0.4
Which platform(s) are affected?
Relevant log output
No response
Code of Conduct