Custom Facebook Login and oauth2

Custom Facebook Login and oauth2

by James McGloin -
Number of replies: 0

Hi all, I am a newbie. I currently using Moodle 3.4 and I allow users to login via the Facebook login button on my site <mysite>/moodle/login .  This works great but I would like users to be able to login from an external page e.g. <mysite>/facebookLogin.html.

 My custom facebook page uses the FaceBook API and I see I get connected from the code at the end of this post:

my response gets  - accessToken and userId.


My Question is:  can I use this information using a moodle api such as 

<mysite>/moodle/auth/oauth2/login.php?id=1&wantsurl=%2F&sesskey=if1vQuBUje ?


Thank you in advance

James


function statusChangeCallback(response) {

    console.log('statusChangeCallback');

    console.log(response);

    // The response object is returned with a status field that lets the

    // app know the current login status of the person.

    // Full docs on the response object can be found in the documentation

    // for FB.getLoginStatus().

    if (response.status === 'connected') {

      // Logged into your app and Facebook.

if (response.authResponse) {

                  alert(response.authResponse);

  alert(response.authResponse.accessToken);

}


Average of ratings: -