Auth0 Home Blog Docs

Authentification facebook with oauth


#1

Hello,
How to get user profile facebook when I authentificate facebook with oauth ?? I search in web but I haven’t any solution … I Use sdk facebook only it’s simple work but I didn’t khnow how to use aouth with facebook

Thanks for advanced


Get user profile facebook in auth0
#2

:wave: @med001

Have you checked out our documentation on connecting your application to Facebook? There are also some details here on implementing social login, with a section on social connections with OAuth.


#3

hello @kim.noel
I follow first link for settings connection with facebook and now I read second link and I apply all points but also error :

my code :

testoauth = function(){
      var webAuth = new auth0.WebAuth({
      domain:       'my domaine',
      clientID:     'id client',
      responseType: 'token',
      redirect_uri: 'redirect uri'
    });
    
    // Trigger login with google
    /*webAuth.authorize({
      connection: 'facebook'
    });*/

    var loginBtn = document.getElementById('btn-login');

    loginBtn.addEventListener('click', function(e) {
      e.preventDefault();
      webAuth.authorize();
    });

  }

in redirect uri I add link added in valid Oauth redirect in application facebook :domain/login/callback but now also error … when I try test connection facebook directly in site oauth (connections->social) I have valid result I have user profile after login … I’m blocked now with this error in my code


#4

@med001 Glad to see the doc was helpful! Could you please share the error you are getting now? Also, when is the error occurring, does it happen when you click on the login button?

From your code, are you following the article JavaScript login?

Can you add the Facebook connection to the event listener:

    webAuth.authorize({ connection: 'facebook' });

#6

Hello,
I succed login with facebook and I get userInfo with this code :

		    webAuth.client.userInfo(authResult.accessToken, function(err, user) {
		    console.log(user);
		}

now I have get all user profile data facebook … with user Info I get email ,family, nickname,gender,name,picture but I have get birthday list likes list articles and other data … how to get all user profile facebook in auth0 and thanks for advanced


#7

@med001 have you request the information from Facebook? You can do so by navigating to go to the Connections > Social section of the Auth0 dashboard, once there you can click on the box with the Facebook logo which will bring up the Facebook settings. It is in here you can select the attributes and permissions.

If I am not mistaken, the permissions get added to the Facebook access_token which is will be stored in the Auth0 user profile, see here, (in particular https://auth0.com/docs/connections/calling-an-external-idp-api#step-3-extract-the-idp-access-token) . You will need to use this access_token to query the additional user information via the Facebook Graph API.

Please let me know if this is the solution you are looking for.


#8

I have reached this stage between days but error is in application facebook (permission application facebook -> submission permission in application facebook)… for get data user profile facebook with auth0 is function getUser in api management or function getAll allows get data all user in auth0

thank you so much @kim.noel