Facebook Instant Verification does not check mobile number through facebook app

Hi, I am implementing Facebook Instant Verification in my application. In my application, I check the number of mobile clients for which I send OTP to check this.

I want to change the approach, as Facebook recently launched the Facebook Instant Verification concept, which checks the mobile phone number based on any number that you set up in your Facebook account.

https://developers.facebook.com/blog/post/2016/12/20/introducing-instant-verification/

https://developers.facebook.com/docs/accountkit/android

https://developers.facebook.com/docs/accountkit/overview

I did everything that the articles say, but since it is written that whenever you enter the same number that is configured in your facebook application, then your account will check your mobile number based on what is in your account write to facebook, otherwise it is sent by OTP then performs a check.

Problem

In my case, I enter the same mobile phone number that is configured in my facebook account and uses the latest facebook application, but it does not check the mobile phone number based on the mobile phone number configured in the facebook application, it always sends OTP.

How it should do verification without OTP. I'm not sure what is missing in my code and setup, as it always does an OTP check.

Please support. Thanks in advance.

AndroidManifest.xml

 <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.facebook.accountkit.ApplicationName" android:value="@string/app_name" /> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/FACEBOOK_APP_ID" /> <meta-data android:name="com.facebook.accountkit.ClientToken" android:value="@string/ACCOUNT_KIT_CLIENT_TOKEN" /> <activity android:name="com.facebook.accountkit.ui.AccountKitActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="@string/ak_login_protocol_scheme" /> </intent-filter> </activity> </application> 

build.gradle

 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "spice.in.accountkitfacebookdemo" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { jcenter() } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:23.0.1' testCompile 'junit:junit:4.12' compile 'com.android.support:design:23.0.1' compile 'com.facebook.android:account-kit-sdk:4.+' compile 'com.google.android.gms:play-services:10.0.1' } 

strings.xml

 <string name="app_name">AccountKitDemo</string> <string name="FACEBOOK_APP_ID">XXX</string> <string name="ACCOUNT_KIT_CLIENT_TOKEN">YYYY</string> <string name="ak_login_protocol_scheme">akXXX</string> 

MainActivity.java

 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AccountKit.initialize(getApplicationContext()); send = (Button) findViewById(R.id.send); send.setOnClickListener(this); } @Override public void onClick(View v) { onLoginPhone(); } public void onLoginPhone() { final Intent intent = new Intent(this, AccountKitActivity.class); AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder = new AccountKitConfiguration.AccountKitConfigurationBuilder(LoginType.PHONE, AccountKitActivity.ResponseType.CODE); // or .ResponseType.TOKEN // ... perform additional configuration ... intent.putExtra(AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION, configurationBuilder.build()); startActivityForResult(intent, APP_REQUEST_CODE); } @Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == APP_REQUEST_CODE) { // confirm that this response matches your request AccountKitLoginResult loginResult = data.getParcelableExtra(AccountKitLoginResult.RESULT_KEY); String toastMessage; if (loginResult.getError() != null) { toastMessage = loginResult.getError().getErrorType().getMessage(); Toast.makeText(this, "Get Error " + loginResult.getError(), Toast.LENGTH_LONG).show(); } else if (loginResult.wasCancelled()) { toastMessage = "Login Cancelled"; } else { if (loginResult.getAccessToken() != null) { toastMessage = "Success:" + loginResult.getAccessToken().getAccountId(); } else { toastMessage = String.format( "Success:%s...", loginResult.getAuthorizationCode().substring(0, 10)); } Toast.makeText(this, "Successfully done", Toast.LENGTH_LONG).show(); } Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show(); } } 

enter image description here

+6
source share
1 answer

You need to add the Android key hashes of your application to your developer portal for instant verification to work. Unfortunately, this is not specified in the current instant check documents (we are working to make this understandable).

Right now, a pair of user users can only perform an instant scan only once per hour. We improve this to allow for infinitive attempts if you are an administrator or application developer, but he will not be ready until the end of the week.

enter image description here

+3
source

Source: https://habr.com/ru/post/1013628/


All Articles