Skip to main content

Using React Native SDK, I see this error each time I open the app. Here is my code

Intercom.loginUserWithUserAttributes({ userId: `${authData.id}` }).then(() => {
this.updateUser(authData, onUpdate)
})

 

Even when I wrap this inside logout then callback, I get the same error.

Intercom.logout().then(() => {

  Intercom.loginUserWithUserAttributes({ userId: `${authData.id}` }).then(() => {

    this.updateUser(authData, onUpdate)

  })

})

Note: This happens only on Android.

 

Hey @hossamnassser938 Racheal from the support engineer team here👋 

 

Are you calling the Intercom.loginUserWithUserAttributes() method multiple times after a user logs into your app? It is expected that you would get that error message, if you called that method multiple times. That method should only be called once, after verification of a login. If any user attributes need to be updated after the user has logged in, you can use the updateUser() method to update them.

 


Hey @Racheal Tnx for the reply 😊

 

You’re right. I was calling Intercom.loginUserWithUserAttributes() multiple times. When I fixed that, the issue was fixed. The strange thing is that this does not cause an issue on IOS.


Hello we should have a way to check if the user is logged in. Even if we only call loginUserWithAttributes() once at the login, we need a way to handle already connected users. For instance, if I set a device token in my code on startup of my app, it should be great to first check I’m correctly logged in to Intercom before calling this specific method (which will throw an error in my code if i’m not logged in on Intercom).


Reply