G_S
G_S

Reputation: 7110

unable to get email address, location, values using oauth.io

I am integrating facebook, twitter, github, linkedin using https://oauth.io/signin third party site. I integrated facebook and was able to successfully get id, name, gender properties directly but am seeing difficulty in getting email address, location values.

enter image description here

In oauth.io site, I even added scope permissions for facebook

enter image description here

I am using the below code to get info of the logged in user.

OAuth.popup('facebook')
            .done(function (result) {
                res = result;
                result.me().done(function (response) {
                    debugger;
                    console.log('me ' + response.name);
                    console.log('me ' + response.email);

                });
            })
            .fail(function (error) {
                alert('fail');
            });

I even tried filtering the results only to give email, birthdate values using

OAuth.popup('facebook')
            .done(function (result) {
                res = result;
                result.me(['email', 'birthdate', 'location']).done(function (response) {
                    debugger;
                    console.log('me ' + response.name);
                    console.log('me ' + response.email);

                });
            })
            .fail(function (error) {
                alert('fail');
            });

But it just returned empty object. Can some one let me know if I am missing something?

Upvotes: 3

Views: 253

Answers (1)

G_S
G_S

Reputation: 7110

I was able to get the required fields for facebook using

 result.get('/me?fields=name,email,gender,birthday').done(function (response) {
                    console.log('me ' + response.name); 
  });

But the same code is not working for twitter. Still looking for an answer which works in a generic way for most of the apis

Upvotes: 3

Related Questions