OAuth, Twitter and Indentity - who am I? - oauth

Once authenticated to Twitter via OAuth I did not see a good call to get your username.
How is this supposed to work? I'd like to pull back things like Twitter username, firstname, lastname, etc... basic profile stuff. Should the OAuth handshake give me my username?

Try this:
https://dev.twitter.com/docs/api/1/get/account/verify_credentials
It'll show you all information (you'ld normally get of any other user) of the OAuth-authenticated-account =)!

First, Twitter includes the screen_name parameter in the access token response. Second, you can call http://api.twitter.com/1/account/verify_credentials.json to get the full profile which will also include the name (JSON key 'name'). Twitter does not provide email addresses.

Have you tried any of these libraries? I've tried just about all of the php ones and all that I tried had examples on how to get the user data.

Related

Get Twitter id with Screen Name

Hi I'm trying to get Twitter ID by Screen name..
Screen name is: KTutorials
Here is my link to get Twitter Id
https://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=ktutorials&count=5000
But I'm getting this error.
{"errors":[{"code":215,"message":"Bad Authentication data."}]}
Here is my Twitter link https://twitter.com/ktutorials
Any Help?
I can see that you are using Twitter API to GET followers/ids method. GET request for this method require OAuth Signature. This means that you should have Twitter App created and if not, you should have create one here.
Subsequently, you should visit GET followers/ids documentation page, and get OAuth Signature using the "OAuth Signature Generator" located at bottom of page.
Bad Authentication data tells that you it can't do the operation due to the bad authentication.
From API V1.1, all requests should be authenticated first. So, create
an app in Twitter console and put the important keys like Access keys
and Consumer keys.
If you feel you are authenticated user, then re-generate your token and give another try!

Twitter reverse auth get full name

I'm following https://github.com/seancook/TWReverseAuthExample for implementing reverse SSO in Twitter to my app.
As a result I get oauth_token, oauth_token_secret, user_id and screen_name. Is there any way to get also full user name (name) of user?
Thanks in advance.
For some reason I can't find it in the ACAccount properties for fullName key. It used to be stored there, but right after reverse auth it is empty. What I'm missing?
The thing was that fullName key exists if user not only added the twitter account, but looked up for details. Otherwise this field is empty. Might help someone.

Twitter oauth parameter

I'm using abraham's twitter oauth and I cannot figure out how to get email parameter, it does not provide a list of parameters. I tried using $content->{email}; but it returns a blank array, any idea how can I get the email?
There is NO way you can get email address of a twitter user. Twitter doesn't provide it in their API.
https://dev.twitter.com/docs/faq#6718

Rails - Twitter API: how to get from ID link to Twitter profile?

From the Twitter API I obtain user's ID (of course beside profile link, username etc). How can I display the link to user's profile according his ID?
For example, Facebook API provide user's ID as well, and if I put to the browser www.facebook.com/users_id, I'll get his profile...
Is there any way to do with Twitter? www.twitter.com/users_id returns empty page...
EDIT: obviously I can save user's URL (or his username), but the respective user can whenever change it...
what do you call a twitter "profile" ? I guess you talk about the user timeline
according to the api doc, your url should probably look like this :
https://api.twitter.com/1/statuses/user_timeline.html?&user_id=(your_id_here)
however, i would advise to use one of the twitter api gems to ease your pain...

Getting Facebook Public Profile URLs

I'm building a feature in my web service to let people enter their Facebook URL into a field. Because few people know their FB user names or public profile URLs, I'd like to provide an interface to assist.
In brief: is there a way to get a list of matching users's public URLs by providing a name alone?
I have tried examining the Facebook Open Graph API; this appears to require knowing the user ID of the person, or the user ID.
I have tried using Mechanize and Nokogiri to automate the process, logging into Facebook as myself and accessing the search feature (http://facebooks.com/search/results.php?q=Person%20Name), but it's not returning any data when attempted this way. I suspect Facebook is using some kind of joojoo to keep me out that way.
Anyone have any suggestions?
With a valid access token, you should be able to query https://graph.facebook.com/me/ to get their ID, name, and public URL (Here's an example using the Graph API Explorer).
There's a search endpoint in the graph API, unfortunately it requires valid user access token.
https://graph.facebook.com/search?q=<name>&type=user&access_token=<user access token>
However it could be yours even, by getting a long living access token it would work for 60 at most, but it's probably a bad idea.
The type could be user, post, event, group, page.
Having done additional research, it appears to not be possible to get a user's public profile page without their permission. Hooray for Facebook privacy settings, I guess.
However, getting an access token is easier than I imagined it would be. Facebook offers an example on their site for getting user permission to access their account, implemented entirely on the client side. Nice and easy; the access token is returned in the URL.
The only downside here is you have to create an application on Facebook, at http://developers.facebook.com/apps. For my purposes, the "Website with Facebook Login" was the application type.
From that point, you can use that token to interrogate the Graph API with ease, as both Warpling and complex857 have suggested.

Resources