intercom_flutter icon indicating copy to clipboard operation
intercom_flutter copied to clipboard

ERROR - [HTTP 401] - Failed Identity Verification check

Open adilexperience opened this issue 1 year ago • 4 comments

Shimmer shows for a while and then gets the error Content could not be loaded. Facing error ERROR - [HTTP 401] - Failed Identity Verification check when trying to open Messenger.

image

This happens for both loginIdentifiedUser and loginUnidentifiedUser. This happens for all functions of the intercom not only the messenger, and help desk.

P.S: In intercom console. We have enabled identity verification.

adilexperience avatar Jun 04 '24 04:06 adilexperience

As you have enabled the identity verification so you have to set the user hash before loginIdentifiedUser. See https://pub.dev/documentation/intercom_flutter/latest/intercom_flutter/Intercom/setUserHash.html

But it should not be the problem with Unidentified users.

deepak786 avatar Jun 04 '24 08:06 deepak786

Thanks for the response @deepak786 .

Update from my side: I tried this same code after about 7 hours and it started working with UnidentifedUser only. I had a chat and it was working fine. But then after some time, it started to appear again and till now I am stuck with this. Same code nothing changed.

adilexperience avatar Jun 05 '24 12:06 adilexperience

Are you executing the whole code, visible in the screenshot, on click?

deepak786 avatar Jun 05 '24 17:06 deepak786

@deepak786

Sorry for the late response. Same behaviour still.

It was working fine with an unidentified user but then I shifted it to the identified user and it worked in debug mode for me. But in the release build, I am again facing this issue.

It is never stable, it start working automatically and then goes away with the exception: Failed Identity Verification check

Any possible updates on this?

adilexperience avatar Aug 28 '24 14:08 adilexperience

For the identified user, first generate a user_hash either with user_id or email (which is being used in loginIdentifiedUser). And then call the API setUserHash

  // generate user hash. see https://gist.github.com/thewheat/7342c76ade46e7322c3e?permalink_comment_id=4575730#gistcomment-4575730
  String userHash = "";

  // set the userHash
  Intercom.instance.setUserHash(userHash).then((value) {
    // login
    return Intercom.instance.loginIdentifiedUser(
      userId: "",
      statusCallback: IntercomStatusCallback(
        onSuccess: () {
          debugPrint("Login successful");
        },
        onFailure: (e) {
          debugPrint("Login Error >>>> ${e.toString()}");
        },
      ),
    );
  }).then((value) {
    // display messenger
    return Intercom.instance.displayMessenger();
  });

deepak786 avatar Nov 27 '24 21:11 deepak786

Hi @deepak786, thanks for the response. I'm working on the same project as @adilexperience did and can confirm that your solution above is still not working.

lristic1310 avatar Dec 14 '24 16:12 lristic1310

Hey @deepak786 after reviewing everything the setup, I can say that the wrong secret key was used for Android when generating hash. Different secret keys are provided dependent on the platform as can be seen in Intercom Dashboard Settings -> Workspace -> Security -> Enforce Identity. This issue can be closed

lristic1310 avatar Dec 14 '24 17:12 lristic1310