react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

[Bug]: Adding externalId, email, tags not working

Open SohelIslamImran opened this issue 1 year ago • 5 comments

What happened?

I'm using "react-native-onesignal": "^5.0.4" with "onesignal-expo-plugin": "^2.0.2", and the below code to add externalId, email, tags :

  OneSignal.login(uid);
  OneSignal.User.addEmail(email);
  OneSignal.User.addTags({...})

But in the dashboard, Audience > Subscriptions, I can see no externalId, email, or tags have been set..

image

Steps to reproduce?

Follow all the steps here: https://documentation.onesignal.com/docs/react-native-expo-sdk-setup Including adding externalId, email and tags

What did you expect to happen?

I expect when I'm calling OneSignal.login(uid);, OneSignal.User.addEmail(email); and OneSignal.User.addTags({...}) with data, I should see these externalId, email and tags in the dashboard

React Native OneSignal SDK version

5.0.4

Which platform(s) are affected?

  • [X] iOS
  • [X] Android

Relevant log output

Xcode logs image

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

SohelIslamImran avatar Feb 07 '24 13:02 SohelIslamImran

Anyone figured how to fix this?

JovanMwesigwa avatar Feb 13 '24 12:02 JovanMwesigwa

Anyone figured how to fix this?

@JovanMwesigwa Yes.. Turn off this image

https://documentation.onesignal.com/docs/identity-verification

SohelIslamImran avatar Feb 14 '24 07:02 SohelIslamImran

Hello, using version "react-native-onesignal": "^5.0.6" I have the same issue using Onesignal.login(externalId) with the external id being something like: R3Fpo3v+cAmelVpSxv5Y82tLY1JTJIZ250jXvGZbaEqjzL4fDEWHG9JT9fwfCnANxpxpAuCd9gmqKUXWj+DFGF==

In some cases I see that the user gets logged in (but even in these cases, the OneSignal.User.addTag method doesn't work). In most of the attempts though, the user doesn't get logged in.

Relevant Log: VERBOSE: network response (OneSignalUser.OSRequestIdentifyUser): { errors = ( { code = "user-2"; meta = { "external_id" = "R3Fpo3v+cAmelVpSxv5Y82tLY1JTJIZ250jXvGZbaEqjzL4fDEWHG9JT9fwfCnANxpxpAuCd9gmqKUXWj+DFGF=="; }; title = "One or more Aliases claimed by another User"; } ); httpStatusCode = 409; }

VERBOSE: executeIdentifyUserRequest failed with error Optional(Error Domain=OneSignalError Code=409 "(null)" UserInfo={returned={ errors = ( { code = "user-2"; meta = { "external_id" = "R3Fpo3v+cAmelVpSxv5Y82tLY1JTJIZ250jXvGZbaEqjzL4fDEWHG9JT9fwfCnANxpxpAuCd9gmqKUXWj+DFGF=="; }; title = "One or more Aliases claimed by another User"; } ); httpStatusCode = 409; }})

DEBUG: executeIdentifyUserRequest returned error code user-2. Now handling user-2 error response... switch to this user. VERBOSE: network response (OneSignalUser.OSRequestFetchUser): { errors = ( { title = "Given alias (external_id: R3Fpo3v+cAmelVpSxv5Y82tLY1JTJIZ250jXvGZbaEqjzL4fDEWHG9JT9fwfCnANxpxpAuCd9gmqKUXWj+DFGF==) doesn't match an existing user"; } ); httpStatusCode = 404; }

ERROR: OSUserExecutor executeFetchUserRequest failed with error: Optional(Error Domain=OneSignalError Code=404 "(null)" UserInfo={returned={ errors = ( { title = "Given alias (external_id: R3Fpo3v+cAmelVpSxv5Y82tLY1JTJIZ250jXvGZbaEqjzL4fDEWHG9JT9fwfCnANxpxpAuCd9gmqKUXWj+DFGF==) doesn't match an existing user"; } ); httpStatusCode = 404; }})

VERBOSE: OSOperationRepo enqueueDelta: OSDelta OS_UPDATE_SUBSCRIPTION_DELTA with property: subscriptionId value: nil

As far as I understand, It seems like it confuses the external id with an alias. If I change the external id to something like "abcdefg12345" it works fine. What could the issue be? The special characters? The length of the external id? In that case, why does the user get logged in randomly? And why does it work fine on Android?

thomaskyr avatar Feb 16 '24 15:02 thomaskyr

Update: The issue is resolved only if I edit the external id, replacing the special characters (+, =, /) with underscore _ or dash - When I do this, the OneSignal.User.addTag method works correctly.

thomaskyr avatar Feb 19 '24 13:02 thomaskyr

Hi, I also have this bug. I'm trying to setup the external_id of a user, where the external_id is my users database uuid, however, the external Id is not set up in any way and I can't debug this. I'm using pure react native for this and the flow is very simple, I initialize OneSignal, request the permission and then login the user, nothing special in my opinion. image Also I can get my externalId with OneSignal.User.getExternalId() but, when trying to send the notification to the external id using the rest API I get this {"id":"","errors":["All included players are not subscribed"]}⏎ but I have a subscription created for the current app running

Raduc4 avatar Apr 05 '24 14:04 Raduc4