سؤال

T have tried following code

OAuth.initialize(public-key);
            OAuth.popup('twitter', function(error, result) {
                console.log(result);
                result.get('/account/verify_credentials').done(function(data) {
                console.log(data);
                });       
                result.get('me').done(function(data) {
                    console.log(data)
                    alert('Hello ' + data.name)
                })
            });

I am able to login using that popup but not getting the info. I am getting oauth_token and oauth_secret_token only. I am getting following error

XMLHttpRequest cannot load https://oauth.io/request/twitter/me. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.

Can you please suggest me to get the user info. Thanks in advance.

هل كانت مفيدة؟

المحلول

Yes. I got it. I have used following code and its working.

result.get("/1.1/account/verify_credentials.json").done(function(data) {
     console.log(data);
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top