Reputation: 55
How can I access or get the permission of the extended scopes provided by the third party identity authorizers like Google or Facebook?
Like, accessing the contacts from Facebook or Google+.
Upvotes: 0
Views: 461
Reputation: 13347
For Facebook you should ask for the permissions that you want to get from the user. For example read_custom_friendlists
permission will grant you access to the user Facebook friend's list. You can request the permissions using the Facebook SDK and integrating it in your app:
@Override
public View onCreateView(
LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.splash, container, false);
loginButton = (LoginButton) view.findViewById(R.id.login_button);
loginButton.setReadPermissions("email");
// If using in a fragment
loginButton.setFragment(this);
// Other app specific specialization
// Callback registration
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
// App code
}
@Override
public void onCancel() {
// App code
}
@Override
public void onError(FacebookException exception) {
// App code
}
});
}
With loginButton.setReadPermissions("email")
you are getting the permission to access to the email of the user. You can check all the permissions that you can get from Facebook developers website.
About Google+, if I'm not wrong you should just use the android sdk to pick contacts from gmail.
hope that it will help you!
Upvotes: 1