Chandra Sekhar
Chandra Sekhar

Reputation: 11

Facebook Account kit Giving Error Authentication failed

When after entering mobile number on account kit popup it told me that We're sorry, something went wrong. and I get :

response.status = NOT_AUTHENTICATED

Code ::-

<div onclick="phone_btn_onclick();" class="btn btn-info text-center">Verify mobile number
          </div>

<script>
var mobile_veri=false;
// initialize Account Kit with CSRF protection
  AccountKit_OnInteractive = function(){
    AccountKit.init(
      {
        appId:1066226316760891,         
        state:"abcd", 
        version:"v1.0"
      }
    );
  };
  function loginCallback(response) {
    console.log(response);
    if (response.status === "PARTIALLY_AUTHENTICATED") {
       mobile_veri=true;
    }
    else if (response.status === "NOT_AUTHENTICATED") {
      // handle authentication failure
      console.log("Authentication failure");
    }
    else if (response.status === "BAD_PARAMS") {
      // handle bad parameters
      console.log("Bad parameters");
    }
  }
   function phone_btn_onclick() {
    var country_code = document.getElementById("country_code").value;
    var ph_num = document.getElementById("phone_num").value;
    AccountKit.login('PHONE', 
      {countryCode: country_code,phoneNumber: ph_num}, // will use default values if this is not specified
      loginCallback);
  }
  function email_btn_onclick() {  
    // you can add emailAddress to set value
    AccountKit.login('EMAIL', {}, loginCallback);
  }
  // destroying session
  function logout() {
        document.location = '/logout';
  }
</script>

ACCOUNT KIT JAVASCRIPT CODE:

enter image description here

App/Account Kit in my Facebook Developer Dashboard:

enter image description here

Upvotes: 1

Views: 845

Answers (0)

Related Questions