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 · 14 comments
Closed

how to get email, first_name, last_name? #11

codigo47 opened this issue Mar 21, 2018 · 14 comments
Labels

Comments

@codigo47
Copy link

@codigo47 codigo47 commented Mar 21, 2018

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

@roughike

This comment has been minimized.

Copy link
Owner

@roughike roughike commented Mar 21, 2018

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

This comment has been minimized.

Copy link
Author

@codigo47 codigo47 commented Mar 21, 2018

Thanks!

@roughike

This comment has been minimized.

Copy link
Owner

@roughike 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 Apr 4, 2018
@codigo47

This comment has been minimized.

Copy link
Author

@codigo47 codigo47 commented Apr 4, 2018

Ok, thanks!

@jukbot

This comment has been minimized.

Copy link

@jukbot 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

This comment has been minimized.

Copy link

@artokun 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

This comment has been minimized.

Copy link

@Zulqurnain Zulqurnain commented Aug 30, 2019

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

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

@furkankurt

This comment has been minimized.

Copy link

@furkankurt furkankurt commented Sep 4, 2019

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?

@MisterioRee

This comment has been minimized.

Copy link

@MisterioRee MisterioRee commented Oct 15, 2019

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

@shakilur157

This comment has been minimized.

Copy link

@shakilur157 shakilur157 commented Dec 2, 2019

can i also get profile picture URL?

@MisterioRee

This comment has been minimized.

Copy link

@MisterioRee MisterioRee commented Dec 3, 2019

@shakilur157

This comment has been minimized.

Copy link

@shakilur157 shakilur157 commented Dec 3, 2019

thanks for the reply @MisterioRee

@gauchok

This comment has been minimized.

Copy link

@gauchok 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

This comment has been minimized.

Copy link

@shakilur157 shakilur157 commented Mar 20, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.