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]: External Id not set when logging users [iOS] #759

Open
2 of 3 tasks
cgmleadtech opened this issue Oct 4, 2023 · 23 comments
Open
2 of 3 tasks

[Bug]: External Id not set when logging users [iOS] #759

cgmleadtech opened this issue Oct 4, 2023 · 23 comments

Comments

@cgmleadtech
Copy link

cgmleadtech commented Oct 4, 2023

What happened?

In iOS I'm logging a user with a certain Id and the external id is not being placed in OneSignal

Steps to reproduce?

1. Initialize and Login into OneSignal with any external Id
`await OneSignal.login('test_id');`
2. Retrieve the OneSignal ID and check if the external id used when logging in works
(it does not)

What did you expect to happen?

I would have expected the external id worked

OneSignal Flutter SDK version

5.0.2

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@emawby
Copy link
Contributor

emawby commented Oct 6, 2023

@cgmleadtech Thank you for reaching out! I am not able to reproduce this can you clarify what you mean by "it doesn't work"

@cgmleadtech
Copy link
Author

cgmleadtech commented Oct 9, 2023

Hi @emawby , so basically when I do the login with a revenuecat ID the external ID is not being set at all

await OneSignal.login(revenueCatUserID);

revenueCatUserID is not null, obviously hahaha

@sharad-paghadal
Copy link

I'm facing same issue. not setting external ID for both Android and iOS.

@emawby
Copy link
Contributor

emawby commented Oct 11, 2023

@sharad-paghadal Thank you for the log that is helpful. Unfortunately I am not able to reproduce this but I will keep investigating. Does your app have identity verification enabled?

@sharad-paghadal
Copy link

thank you @emawby , that was the issue. Just turned off identity verification and everything is working!!

@cgmleadtech
Copy link
Author

@emawby I do not have identity verification enabled, and if I add as external id any kind of string, not just the revenuecatid, it does not work
users still appears as:
Screenshot 2023-10-13 at 12 52 50

@RicBau2610
Copy link

@emawby thank you for the tip! I have faced the same Problem, turned the identity verification to disable, with solved my issue. It's nice to see, that there are no hints on the documentation.

@jmmdk
Copy link

jmmdk commented Nov 1, 2023

@cgmleadtech, it seems you're using both OneSignal and RevenueCat. So am I (for an unreleased Flutter app). But for the integration to work, according to RevenueCat's documentation, the app needs to send $onesignalId to RevenueCat's user attributes:

image

But I can't find a way to get the OneSignal ID in v.5.0.3.

Onesignal ID was previously available in v3.x.x but now only the subscription ID and the token are available from the Onesignal.User.pushSubscription.id property.

How can I get it?

How are you integrating OneSignal and RevenueCat if you're not using the OneSignal ID?

Thanks :)

@cgutierr-zgz
Copy link

@cgmleadtech, it seems you're using both OneSignal and RevenueCat. So am I (for an unreleased Flutter app). But for the integration to work, according to RevenueCat's documentation, the app needs to send $onesignalId to RevenueCat's user attributes:

image

But I can't find a way to get the OneSignal ID in v.5.0.3.

Onesignal ID was previously available in v3.x.x but now only the subscription ID and the token are available from the Onesignal.User.pushSubscription.id property.

How can I get it?

How are you integrating OneSignal and RevenueCat if you're not using the OneSignal ID?

Thanks :)

I think you can read the migration guide and that actually the push subscription.id is what you are looking for but mayb I'm wrong

@emawby could you clarify this?

@nan-li
Copy link
Contributor

nan-li commented Nov 1, 2023

Identity verification is not yet supported and still in development. @RicBau2610: you're right, this limitation should be clear in documentation. We will work on updating all our docs.

@jmmdk and @cgutierr-zgz: the OneSignal ID can be retrieved via our REST API or our Server SDKs using the

  1. View user endpoint
  2. View user identity endpoint
  3. View user identity (by subscription) endpoint

The OneSignal ID is different from the Push Subscription ID.

We see the need to be able to get the OneSignal ID from the SDK, and will be adding a getter.

@nan-li
Copy link
Contributor

nan-li commented Nov 1, 2023

@cgmleadtech, I am also not able to reproduce. Is this is only happening on iOS?

  1. Is this consistent behavior or random?
  2. Is this on a new app install? This is the first time login is called?
  3. Can you turn on logging to VERBOSE with OneSignal.Debug.setLogLevel(LogLevel.Verbose) BEFORE you call OneSignal.initialize(APP_ID) and share logs from the time you call login?

@jmmdk
Copy link

jmmdk commented Nov 2, 2023

@nan-li, thanks for your response.

However, I just got a response to my message to your support and they say that we should simply send RevenueCat the Subscription ID instead of the OneSignal ID (contrary to the RC docs).

So is support wrong and the docs are correct? If so, that means that we can't actually integrate with RC because you don't have a getter for that OneSignal ID? We don't use the REST API/server SDK. And if that's true, how fast can you add that getter? We really need that ASAP.

@rignaneseleo
Copy link

We see the need to be able to get the OneSignal ID from the SDK, and will be adding a getter.

Yeah I think you really just need a getter because I can already read the onesignalId from the debug prints so I guess it's there?

D/OneSignal(30889): [Thread-41] OperationRepo.enqueueAndWait(operation: {"name":"refresh-user","appId":"049c6e09-dea1-4649-84f9-c695a********","onesignalId":"a7ef6ff9-9b4b-4121-aa21-c0b7*******"}, force: true)

@RogerBrusamarello
Copy link

Any updates on this topic?

@monkapepega
Copy link

Hi, is there any update on the OneSignal ID getter?

@trymersi
Copy link

i think if you are all only want to get the Onesignal ID, you just use this
OneSignal.User.pushSubscription.id

@chaos128
Copy link

@nan-li @emawby

I was facing the same issue.
in my case, my external ID (ex: 46644) has more than 200 subscriptions.
I used rest api to set exteranl ID to subscription, the response says
"meta":{"user_subscription_limit":200}}

but OneSignal.login(46644) with sdk didn't return any error message.

I deleted all subscriptions linked with my external ID then it works.

@tamamura3
Copy link

In my case, OneSignal.login(session.user.id); doesn't work on iOS, but OneSignal.login("${session.user.id}"); works fine, and external_id is set correctly.

@nan-li
Copy link
Contributor

nan-li commented Jun 16, 2024

Hi everyone, I apologize for the delayed response. If you are managing at the user-level rather than device-level (which is what the subscription ID effectively does), please use the OneSignal ID as the identifier.

The get method was added in Release 5.1.3.

@nan-li
Copy link
Contributor

nan-li commented Jun 16, 2024

Hi @chaos128, the login method itself will not return an error, but logs should show the error response once the request is made to the OneSignal server.

Hi @tamamura3, the login method requires a string for the external ID passed in. It appears session.user.id itself is not a string and needed to be stringified?

@LiLatee
Copy link

LiLatee commented Jul 24, 2024

Hm I also have an issue that externalId is not set up properly and I am receiving such an error.
I don't use aliases 🤔
Package version: 5.2.2
image

EDIT: I found a separate thread for my issue #714

@sorosons
Copy link

sorosons commented Sep 19, 2024

Hello Everyone,
Finally We have fixed with @SabirHalil
In ios when user not accepted notification and one signal permission and you request for login that time it not set external id you must be sure to user accepted permission than login and it will works fine

OneSignal.Notifications.addPermissionObserver((state) {
print("Has permission " + state.toString());
if (state) {
print("Has permission Accepted" + state.toString());
setUserExternalId();
}
}); you can use like that and it will works.

@jennantilla
Copy link
Contributor

Hello everyone--appreciate the discussion here! It looks like the conversation has wrapped up with some good solutions. Any additional concerns before we close this out?

Just as an FYI since it was mentioned in this thread: Identity Verification beta for Flutter is in the works and should be ready in the next few weeks.

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