I’m trying to retrieve the user PhoneNumber/email using Facebook Account kit.
I’m always getting an error as response:
200: Server generated an error: 145: API calls from the server require
an appsecret_proof argument
I already Disabled the option on Facebook Developer Dash Board.
Require app secret for server API calls
Here is my code:
public void onLoginPhone(final View view) {
final Intent intent = new Intent(getActivity(), 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);
}
and this is onActivityResult:
AccountKit.getCurrentAccount(new AccountKitCallback<Account>() {
@Override
public void onSuccess(final Account account) {
// Get Account Kit ID
String accountKitId = account.getId();
// Get phone number
PhoneNumber phoneNumber = account.getPhoneNumber();
String phoneNumberString = phoneNumber.toString();
// Get email
String email = account.getEmail();
}
@Override
public void onError(final AccountKitError error) {
// Handle Error
}
});
2
Answers
Simple solution to solve above problem, just follow following step.
Step 1 : Go to Facebook developer console
Step 2 : Select your application from the
Step 3: After selecting your application Click on Account kit located at left side panel of console below the product Title.
Step 4 : After click on Account kit you see the Reuired App Secret switch button with yes/no option right side of it.
Step 5 : Turn Off (No) the Reuired App Secret from the there ( below the allow sms login )
Step 6 : Click on Save changes tab.
Step 7 : Run your application, you will got whatever you want.
If you have still any query ask me to any time. may be these help to you or other person.
I had the same problem. The three steps which solved my problem:
Turn off the option “App Require Secret”
Make sure the option “Enable Client Access Token Flow ” has turned on, set
to “YES”
User this
AccountKitActivity.ResponseType.TOKEN instead of AccountKitActivity.ResponseType.CODE
ResponseType.CODE will never return you the mobile number.
Hope it helps.