Answered

On iOS, when do we have to call setUserHash?

  • 22 January 2021
  • 4 replies
  • 114 views

I turned on Identity Verification and therefore need to set a user hash.

 

The documentation states this to set the User Hash:

  • When your iOS app initializes Intercom if the user is identified (i.e., you have a user id or email address), pass in a String of the HMAC returned from your server's authentication call. This should be called before any registration calls.

 

I looked at the Intercom iOS sample app here. I do see that registerUser is called in two places:

  1. On app launch inside of: AppDelegate/didFinishLaunchingWithOptions (Objective-C sample) or SceneDelegate/willConnectTo (Swift sample)
  2. On user tapping login: handleUserLogin

 

My question is: do I have to call setUserHash in both places as well? The documentation states I need to call setUserHash before any registration calls. I'm not sure if this means that I have to call it in both app launch and user tapping login.

 

Could someone please confirm when to call setUserHash?

icon

Best answer by Anonymous 26 January 2021, 10:00

View original

4 replies

Hi @larry n​! You'll need to call setUserHash in both places 👍

Hi @[Mathew Cropper] (Intercom Employee)​! Thank you for answering!!! 🙏🙏

 

One follow up question, should setUserHash be called right before registerUser always? In the documentation here there is a part that states to call setUserHash before any registration calls. My assumption is that this means call setUserHash before registerUser in both places (app launch and user tapping login).

 

hash-2Is my assumption correct?

Yes, that's right. You'll need to do that every time.

Thank you Mathew! Appreciate the help!

Reply