[Bug]: External ID set in Login doesn't actually get set in the Dashboard.
What happened?
When I pass a string into the login(String) function that has never before been associated with the current device, OneSignal generates a new identity (represented by a new OneSignal ID). However, that new identity does not have the string passed into the login(String) function set as an external id.
Steps to reproduce?
1. Start the app.
2. Pass an external id into the `login(String)` function that has never before been associated with the device used.
3. Let the OneSignal SDK do it's stuff.
4. Look at the subscription in the OneSignal dashboard.
Result: The OneSignal ID value has been updated and the External ID value has been cleared.
What did you expect to happen?
I expected OneSignal to set the string I passed into the login(String) function in the OneSignal backend in such a way that the dashboard can display it.
OneSignal Android SDK version
5.0.5
Android version
9
Specific Android models
* Google Pixel 5 (running Android 14 but Android 14 was not available to select in the selector above.)
* Samsung Galaxy S8
Relevant log output
2023-12-22 14:25:05.057 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/users/by/onesignal_id/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
2023-12-22 14:25:05.057 11975-12204 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-7] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/iams
2023-12-22 14:25:05.057 11975-12189 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-1] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/android_params.js?player_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
2023-12-22 14:25:05.059 11975-12189 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-1] HttpClient: Adding header if-none-match: W/"c62925585d35f765e3f5824e01572576"
2023-12-22 14:25:05.509 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityCreated(0,APP_CLOSE): xxx.xxx.xxxxx.activities.splashScreen.SplashScreenActivity@5024b5a
2023-12-22 14:25:05.868 11975-12204 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-7] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/iams - STATUS: 200 JSON: {"in_app_messages":[]}
2023-12-22 14:25:05.873 11975-12199 OneSignal xxx.xxx.xxxxx.debug D [Thread-15] InAppMessagesManager.evaluateInAppMessages()
2023-12-22 14:25:05.885 11975-12189 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-1] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/android_params.js?player_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - Using Cached response due to 304: {"awl_list":{},"android_sender_id":"xxx","chnl_lst":[{"chnl":{"id":"OS_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","nm":"ChannelName","dscr":"ChannelDescription","grp_id":"OS_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","grp_nm":"GroupName"}}],"enterp":true,"outcomes":{"direct":{"enabled":true},"indirect":{"notification_attribution":{"minutes_since_displayed":60,"limit":10},"enabled":true},"unattributed":{"enabled":true}},"receive_receipts_enable":true}
2023-12-22 14:25:05.916 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/users/by/onesignal_id/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - STATUS: 200 JSON: {"properties":{"language":"de","timezone_id":"Europe/Zurich","country":"CH","first_active":1703178479,"last_active":1703250627,"ip":"xxx.xxx.xxx.xxx"},"identity":{"external_id":"myId","onesignal_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"},"subscriptions":[{"id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","app_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","type":"AndroidPush","token":"xxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","enabled":true,"notification_types":-99,"session_time":0,"session_count":4,"sdk":"040806","device_model":"Pixel 5","device_os":"14","rooted":false,"test_type":0,"app_version":"1","net_type":0,"carrier":"","web_auth":"","web_p256":""},{"id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","app_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","type":"AndroidPush","token":"xxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","enabled":true,"notification_types":-99,"session_time":0,"session_count":2,"sdk":"040806","device_model":"SM-G950F","device_os":"9","rooted":false,"test_type":0,"app_version":"1","net_type":0,"carrier":"","web_auth":"","web_p256":""}]}
2023-12-22 14:25:05.949 11975-12192 OneSignal xxx.xxx.xxxxx.debug V [Thread-12] Creating notification channel with channel:
NotificationChannel{mId='OS_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', mName=ChannelName, mDescription=hasDescription , mImportance=3, mBypassDnd=false, mLockscreenVisibility=0, mSound=content://settings/system/notification_sound, mLights=true, mLightColor=0, mVibration=null, mUserLockedFields=0, mFgServiceShown=false, mVibrationEnabled=true, mShowBadge=true, mDeleted=false, mGroup='OS_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', mAudioAttributes=AudioAttributes: usage=USAGE_NOTIFICATION content=CONTENT_TYPE_SONIFICATION flags=0x0 tags= bundle=null, mBlockableSystem=false}
2023-12-22 14:25:05.976 11975-12193 OneSignal xxx.xxx.xxxxx.debug D [OpRepo] OperationRepo: execute response = SUCCESS
2023-12-22 14:25:06.241 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityStarted(0,APP_CLOSE): xxx.xxx.xxxxx.activities.splashScreen.SplashScreenActivity@5024b5a
2023-12-22 14:25:06.242 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService: current activity=xxx.xxx.xxxxx.activities.splashScreen.SplashScreenActivity@5024b5a
2023-12-22 14:25:06.243 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.handleFocus: application is now in focus, nextResumeIsFirstActivity=true
2023-12-22 14:25:06.264 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] BackgroundManager cancel background sync
2023-12-22 14:25:06.265 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] SessionService.onFocus()
2023-12-22 14:25:06.272 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] InfluenceManager.attemptSessionUpgrade(entryAction: APP_OPEN, directId: null)
2023-12-22 14:25:06.273 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] InfluenceManager.attemptSessionUpgrade: try UNATTRIBUTED to INDIRECT upgrade
2023-12-22 14:25:06.274 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ChannelTracker.getLastReceivedIds: lastChannelObjectReceived: []
2023-12-22 14:25:06.276 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] InfluenceManager.attemptSessionUpgrade: Trackers after update attempt: [ChannelTracker{tag=notification_id, influenceType=INDIRECT, indirectIds=["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], directId=null}, ChannelTracker{tag=iam_id, influenceType=UNATTRIBUTED, indirectIds=null, directId=null}]
2023-12-22 14:25:06.289 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityResumed(1,APP_OPEN): xxx.xxx.xxxxx.activities.splashScreen.SplashScreenActivity@5024b5a
2023-12-22 14:25:06.602 11975-12189 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-1] initWithContext(context: xxx.xxx.xxxxx.MyApplication@b002c18, appId: null)
2023-12-22 14:25:06.602 11975-12189 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-1] initWithContext: SDK already initialized
2023-12-22 14:25:06.604 11975-12189 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-1] Retrieving service interface com.onesignal.notifications.internal.restoration.INotificationRestoreProcessor
2023-12-22 14:25:06.605 11975-12189 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-1] Already instantiated: com.onesignal.notifications.internal.restoration.impl.NotificationRestoreProcessor@1706039
2023-12-22 14:25:06.605 11975-12189 OneSignal xxx.xxx.xxxxx.debug I [DefaultDispatcher-worker-1] Restoring notifications
2023-12-22 14:25:15.467 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] login(externalId: newId, jwtBearerToken: null)
2023-12-22 14:25:15.468 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] createAndSwitchToNewUser()
2023-12-22 14:25:15.474 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] Retrieving service interface com.onesignal.core.internal.application.IApplicationService
2023-12-22 14:25:15.475 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] Already instantiated: com.onesignal.core.internal.application.impl.ApplicationService@f124671
2023-12-22 14:25:15.480 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] Retrieving service interface com.onesignal.core.internal.application.IApplicationService
2023-12-22 14:25:15.481 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] Already instantiated: com.onesignal.core.internal.application.impl.ApplicationService@f124671
2023-12-22 14:25:15.496 11975-12191 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-3] OperationRepo.enqueue(operation: {"name":"transfer-subscription","appId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","subscriptionId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","onesignalId":"local-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}, flush: false)
2023-12-22 14:25:15.511 11975-12431 OneSignal xxx.xxx.xxxxx.debug D [Thread-26] OperationRepo.enqueueAndWait(operation: {"name":"login-user","appId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","onesignalId":"local-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","externalId":"newId"}, force: true)
2023-12-22 14:25:15.708 11975-12193 OneSignal xxx.xxx.xxxxx.debug D [OpRepo] LoginUserOperationExecutor(operation: [{"name":"login-user","appId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","onesignalId":"local-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","externalId":"newId","id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}, {"name":"transfer-subscription","appId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","subscriptionId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","onesignalId":"local-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}])
2023-12-22 14:25:15.794 11975-12206 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-8] HttpClient: POST apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/users - {"identity":{"external_id":"newId"},"subscriptions":[{"id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}],"properties":{"timezone_id":"Europe\/Zurich","language":"de"},"refresh_device_metadata":true}
2023-12-22 14:25:15.911 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityPaused(1,APP_OPEN): xxx.xxx.xxxxx.activities.splashScreen.SplashScreenActivity@5024b5a
2023-12-22 14:25:16.001 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityCreated(1,APP_OPEN): xxx.xxx.xxxxx.activities.main.MainActivity@2c731d5
2023-12-22 14:25:16.068 11975-12206 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-8] HttpClient: POST apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/users - STATUS: 201 JSON: {"properties":{"language":"de","timezone_id":"Europe/Zurich","country":"CH","last_active":1703251514,"ip":"xxx.xxx.xxx.xxx"},"identity":{"external_id":"newId","onesignal_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"},"subscriptions":[{"id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","app_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","type":"AndroidPush","token":"xxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]}
2023-12-22 14:25:16.081 11975-12193 OneSignal xxx.xxx.xxxxx.debug D [OpRepo] OperationRepo: execute response = SUCCESS
2023-12-22 14:25:16.096 11975-12431 OneSignal xxx.xxx.xxxxx.debug D [Thread-26] OperationRepo.enqueueAndWait(operation: {"name":"refresh-user","appId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","onesignalId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}, force: true)
2023-12-22 14:25:16.299 11975-12193 OneSignal xxx.xxx.xxxxx.debug D [OpRepo] RefreshUserOperationExecutor(operation: [{"name":"refresh-user","appId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","onesignalId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}])
2023-12-22 14:25:16.305 11975-12206 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-8] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/users/by/onesignal_id/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
2023-12-22 14:25:16.415 11975-12206 OneSignal xxx.xxx.xxxxx.debug D [DefaultDispatcher-worker-8] HttpClient: GET apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/users/by/onesignal_id/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - STATUS: 200 JSON: {"properties":{"language":"de","timezone_id":"Europe/Zurich","first_active":1703178479,"last_active":1703248585,"ip":"xxx.xxx.xxx.xxx"},"identity":{"onesignal_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"},"subscriptions":[{"id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","app_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","type":"AndroidPush","token":"xxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","enabled":true,"notification_types":-99,"session_time":0,"session_count":2,"sdk":"040806","device_model":"SM-G950F","device_os":"9","rooted":false,"test_type":0,"app_version":"1","net_type":0,"carrier":"","web_auth":"","web_p256":""}]}
2023-12-22 14:25:16.446 11975-12193 OneSignal xxx.xxx.xxxxx.debug D [OpRepo] OperationRepo: execute response = SUCCESS
2023-12-22 14:25:16.904 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] NotificationsManager.requestPermission()
2023-12-22 14:25:16.921 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityStarted(1,APP_OPEN): xxx.xxx.xxxxx.activities.main.MainActivity@2c731d5
2023-12-22 14:25:16.922 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService: current activity=xxx.xxx.xxxxx.activities.main.MainActivity@2c731d5
2023-12-22 14:25:16.972 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityResumed(2,APP_OPEN): xxx.xxx.xxxxx.activities.main.MainActivity@2c731d5
2023-12-22 14:25:18.733 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityStopped(2,APP_OPEN): xxx.xxx.xxxxx.activities.splashScreen.SplashScreenActivity@5024b5a
2023-12-22 14:25:18.744 11975-11975 OneSignal xxx.xxx.xxxxx.debug D [main] ApplicationService.onActivityDestroyed(1,APP_OPEN): xxx.xxx.xxxxx.activities.splashScreen.SplashScreenActivity@5024b5a
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@raffaelgyr thank you for reaching out! We're looking into this and will get back to you as soon as possible.
Hi @raffaelgyr just an update: ~I haven't been able to reproduce this.~
EDIT: Confirmed that this can be reproduced if one user is already logged in and login is called again with a new external_id. This is a known backend issue that we are working on fixing. We will update this issue once resolved.
Can you double confirm that the onesignal_id in your logs matches the onesignal_id you're viewing in the dashboard?
The onesignal id prefixed with "local-" is not the correct one, however the onesignal id without the prefix is the one that gets set correctly to the OneSignal backend.
I can also confirm that I still have the problem and I also still have it with version 5.1.0 of the OneSignal Android SDK.
Confirmed that this can be reproduced if one user is already logged in and login is called again with a new external_id. This is a known backend issue that we are working on fixing. We will update this issue once resolved.
Yes, that seems to be the issue. When I call logout() immediately before calling login(String) it seems to work correctly, even despite the fact that the logout request probably hasn't reached the backend by the time the login(String) function gets called.
I didn't realize that setting a new external id while one is already set, is no longer supported under the user centric model.
Hello @raffaelgyr just a heads up that this has been fixed on the backend!
I'll go ahead and close this issue but please let us know if you have any additional questions or concerns. Thanks for your patience!