Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get email, first_name, last_name? #11

Closed
codigo47 opened this issue Mar 21, 2018 · 18 comments
Closed

how to get email, first_name, last_name? #11

codigo47 opened this issue Mar 21, 2018 · 18 comments
Labels
enhancement New feature or request

Comments

@codigo47
Copy link

Hi Liro, is there any way to get those fields on the login? thanks

@roughike roughike added the enhancement New feature or request label Mar 21, 2018
@roughike
Copy link
Owner

I can look into this later this week, but cannot promise anything for now. Also, I'm not sure if it's in the scope of this plugin: the name is flutter_facebook_login, and that's the thing it does.. :)

If you're in a rush, you can already do it today.

  1. Get the access token for the user using this plugin.
  2. Make a standard HTTP Graph request according to the Facebook documentation to retrieve the user profile. Use the token you get by using this plugin to authenticate.

@codigo47
Copy link
Author

Thanks!

@roughike
Copy link
Owner

roughike commented Apr 4, 2018

Update: I have no plans of doing it currently.

Anyway, here's sample code for doing it.

var result = await facebookSignIn.logInWithReadPermissions(['email']);
var accessToken = result.accessToken;
var graphResponse = await http.get(
            'https://graph.facebook.com/v2.12/me?fields=name,first_name,last_name,email&access_token=${accessToken.token}');
var profile = JSON.decode(graphResponse.body);

Now profile contains something like this:

{
   "name": "Iiro Krankka",
   "first_name": "Iiro",
   "last_name": "Krankka",
   "email": "iiro.krankka\u0040gmail.com",
   "id": "<user id here>"
}

Closing this one, but thanks for the suggestion!

@roughike roughike closed this as completed Apr 4, 2018
@codigo47
Copy link
Author

codigo47 commented Apr 4, 2018

Ok, thanks!

@jukbot
Copy link

jukbot commented Apr 9, 2018

I recommended adding this to readme or the document. 👍

BTW: It's good to implement built-in getting profile info API.

@artokun
Copy link

artokun commented Aug 28, 2019

Adding public_profile worked for me, I got back all the pertinent details.

final FacebookLoginResult facebookLoginResult = await _facebookLogin
          .logInWithReadPermissions(['email', 'public_profile']);

@Zulqurnain
Copy link

final FacebookLoginResult facebookLoginResult = await _facebookLogin
          .logInWithReadPermissions(['email', 'public_profile']);

what do you mean i only got status and token using this

@furkankurt
Copy link

Adding public_profile worked for me, I got back all the pertinent details.

final FacebookLoginResult facebookLoginResult = await _facebookLogin
          .logInWithReadPermissions(['email', 'public_profile']);

Can you get the user's name?

@mr-muhammad-rehan
Copy link

Cannot request for graph API scopes #199
Could someone look into this?

@shakilur157
Copy link

can i also get profile picture URL?

@mr-muhammad-rehan
Copy link

Yes, @shakilur157 you can,

Take a look here:

@shakilur157
Copy link

thanks for the reply @MisterioRee

@gauchok
Copy link

gauchok commented Mar 20, 2020

I have a problem with facebook login on android

var login = FacebookLogin ();
     login.loginBehavior = FacebookLoginBehavior.webViewOnly;
     final result = await login.logIn (['email']);

in the third line close the app

Failed to send request: {"jsonrpc": "2.0", "id": "210", "method": "resume", "params": {"isolateId": "isolates / 637907629644467"}}

I perfectly followed in the footsteps of https://pub.dev/packages/flutter_facebook_login#-readme-tab-

please help

@shakilur157
Copy link

shakilur157 commented Mar 20, 2020 via email

@mitoapantao
Copy link

Help! No Funciona .logInWithReadPermissions(['email', 'public_profile']); en su lugar eh puesto .logIn(['email', 'public_profile']); pero no funciona, alguna idea de como utilizar esa nueva función de AndroidX

@MeshkaniMohammad
Copy link

'public_profile'

Is it reliable for version 3.0.0 too?

@ahmed23423
Copy link

if i need more information like the password and more

@mr-muhammad-rehan
Copy link

if i need more information like the password and more

You can't, do that.
Facebook does not allow that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests