views:

37

answers:

2

Is there a way to get the screenname of the current logged in user?

The show requires id or user_id or screen_name, but I don't have any of those.


I could only think about a workaround, that would be to make a request to twitter.com and get the contents of the <span id="me_name">

A: 

have you tried account/verify_credentials

Puaka
It asks for authorization. I don't have the access token at this point.
BrunoLM
right, you need that for the function, have you tried @Anywhere, pretty easy to setup
Puaka
with anywhere you can do something like :twttr.anywhere(function(T) { if(T.isConnected()) { var currentUser = T.currentUser; screenName = currentUser.data('screen_name'); }});
Puaka
Trying to use that script T.isConnected() returned false, and I was online at Twitter. I just need to know how to get the T.currentUser.data("screen_name"), I don't need anything else.
BrunoLM
weird.. it should be working both on REST and @Anywhere, what you can do is clear all you browser cache, then use anywhere to connect, once connected, you should get the screen name, you can put it inside auth_complete and use it like this :T.bind("authComplete", function (e, user) { currentUser = T.currentUser; screenName = currentUser.data('screen_name'); });
Puaka
A: 

It's not possible without oAuth.

The only workaround is the one mentioned on the question.

BrunoLM

related questions