Skip to main content
Answered

loginUser fails with "400 user already exists"


Hello,

 

It seems we cannot reliably use Intercom on iOS due to an API error.

 

We are trying to identify a customer with a uuid, email, and identity hash (derived from the uuid). Our integration was working until we upgraded to the 14 SDK. Now everytime we call either loginUser or updateUser we receive a “400 user already exists” error message. This happens for some users and not others, but is resulting in production customers not being identified.

Best answer by Racheal

Hey @Jacob H Racheal from the support engineer team here👋 

 

I’m sorry to hear you are running into this! Are you calling logout() right before this login or update call? I have seen previous customers run into issues by calling logout() directly before registering a user. What happens is, when the user next logs in we see them as already registered because logout never ran. If that is the case, could you test out putting some time between those two calls to see if that improves things and let me know?

View original
Did this topic help you find an answer to your question?

8 replies

  • Author
  • New Participant
  • 2 replies
  • March 27, 2023

Racheal
Intercom Team
Forum|alt.badge.img+5
  • Customer Support Engineer
  • 512 replies
  • Answer
  • March 29, 2023

Hey @Jacob H Racheal from the support engineer team here👋 

 

I’m sorry to hear you are running into this! Are you calling logout() right before this login or update call? I have seen previous customers run into issues by calling logout() directly before registering a user. What happens is, when the user next logs in we see them as already registered because logout never ran. If that is the case, could you test out putting some time between those two calls to see if that improves things and let me know?


  • Author
  • New Participant
  • 2 replies
  • April 11, 2023

@Rachael no we are not. This is upon first login to a fresh app start.


  • New Participant
  • 4 replies
  • April 24, 2023

Having same issue as well.


  • New Participant
  • 4 replies
  • April 24, 2023

@Racheal It looks like that if we call the loginUser method any other place aside from in the didFinishLaunchingWithOptions  say within our sign in routine, we get the 400 unless we specifically logout before.


Jacob Cox
Intercom Team
Forum|alt.badge.img+5
  • Sr. Technical Support Engineer
  • 441 replies
  • May 27, 2023

@Jacob H 

Are you still running into this issue? If so, do you have error logs around this that you can share? Also have you tried updating to version 15 of the SDK? If so, are you still running into the issue?


  • New Participant
  • 2 replies
  • August 8, 2024

Hello, @Jacob H 
I have met this issue with one of our users on Production. Initially I’ve noticed that events and data updates are sent to a wrong account (a temporary one, which was expected to be abandoned in case of an error). Digging deeper I have found that both methods - loginUser() and updateUser() - continue returning “ERROR - [HTTP 400] - User already exists.” for that user.

Analyzing what may have caused this, and the previous answers in this thread, I assume that most probably this happens in cases when no logOut() were called on this particular device before doing loginUser(), is that true?(yet I’m unsure why updateUser() doesn’t work in this case, could be because user’s id and email don’t match).

However, I can’t expect that a graceful logout will be reliably done. Users don’t always use the “Log Out” button, their network connection not always perfect when they use it, etc.

Long story short.. is there a way to determine that a user session is still active (no graceful logout was done for an unknown reason) in order to call logOut in rare cases like these? Calling logOut on each and every app launch sounds excessive, as well as the documentation doesn’t suggest anywhere to do always call logOut before performing loginUser.

Ideally it would be cool if loginUser determined this situation and performed logOut under the hood instead of returning error. But until then we, developers, need a strategy in place to reliably cover this particular edge case.

[iOS SDK version = 16.6.2]


  • New Participant
  • 1 reply
  • September 4, 2024

Similar thing happening to me with updateContact API endpoint. This error is missing from the documentation. Any idea how to fix?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings