roughike/flutter_facebook_login

Question: Can user_photos be passed as permission to logInWithReadPermissions ?

maoo opened this issue · 4 comments

maoo commented

Hi. I'm using https://github.com/roughike/flutter_facebook_login to authenticate users in my app, all good. Now I want to fetch their uploaded photos, so I tried to pass user_photos in the (logInWithReadPermissions) permission list, but the Facebook app crashes with (apparently) no error.

Steps to reproduce

  1. Create a new Flutter project on Android Studio (follow https://flutter.io/using-ide/#creating-projects and related docs)
  2. Edit lib/main.dart to add the flutter_facebook_login (follow https://github.com/roughike/flutter_facebook_login#how-do-i-use-it)
  3. Change call to var result = await facebookLogin.logInWithReadPermissions(['email','user_photos']); , adding user_photos in the list of permissions

Expected behaviour

I'd expect the Facebook app to open and authenticate the user, passing back the token to my app, so that the following logic returns a list of photos.

	graphResponse = await http.get(
	  'https://graph.facebook.com/v2.12/me/photos/uploaded?access_token=${accessToken.token}');
	var photos = json.decode(graphResponse.body);

Any hint/direction/suggestion? Thanks in advance!

Have you followed the Facebook documentation for user_photos permission?

This permission is restricted to a limited set of partners and usage requires prior approval by Facebook ... Requesting this permission requires you to submit your app for Login Review.

maoo commented

Thanks @roughike , that's probably what I was missing, sorry for the rookie mistake.

Does it also mean that the code I mentioned above should work?

TY!

Don't know without further crash logs, but your code seems to be fine.

maoo commented

Super useful, thanks for your code and help @roughike