Open rhdez opened 1 year ago
Seems to be related to the externalId
special character. In my case, replacing the |
with %7C
solved the issue.
Quote by Apple docs:
Important For apps linked on or after iOS 17 and aligned OS versions, URL parsing has updated from the obsolete RFC 1738/1808 parsing to the same RFC 3986 parsing as URLComponents. This unifies the parsing behaviors of the URL and URLComponents APIs. Now, URL automatically percent- and IDNA-encodes invalid characters to help create a valid URL.
https://developer.apple.com/documentation/foundation/url/3126806-init
So this is definitively a bug. It seems that the SDK is not percent encoding the externalId
when it creates the GET URL.
https://api.onesignal.com/apps/[APP_ID]/users/by/external_id/auth0|1234asd1234
And the above string is not a valid URL because it includes the special char: | and it is not escaped
For swift, this could be solved by calling this method:
addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
@rhdez Thank you for reporting and for the in depth investigation! We will work on a fix for this. To clarify iOS 17 allows this special character in the url but iOS 16 does not?
@emawby That is right. As the Apple documentation say for iOS 17:
Now, URL automatically percent- and IDNA-encodes invalid characters to help create a valid URL
But that was not the default behavior for iOS 16 and below, so I understand this as an SDK bug.
Thank you for your reply. Glad to help!
Agreed thank you for the update
What happened?
This happens with iOS 16 but in iOS 17. After
OneSignal.login(externalId)
with an existingexternalId
, the session never get updated with the subscription because theOneSignalUser.OSRequestFetchUser
fails with this error:Before this happen, the login tried to POST the
externalId
getting an error:DEBUG: executeIdentifyUserRequest returned error code user-2. Now handling user-2 error response... switch to this user.
Right after this, the above error appears.With iOS 17, right after the user-2 error, the
OneSignalUser.OSRequestFetchUser
returns a success response with the session data.NOTE the
externalId
is something like:auth0|12345676
Steps to reproduce?
What did you expect to happen?
To retrieve the tags from the user with the
externalId
OneSignal iOS SDK version
Release 5.0.1 and 5.0.2
iOS version
16
Specific iOS version
Relevant log output