Get twitter and google+ profile images? - twitter

I'm integrating my site with OAuth to facebook, twitter and google+
I can get the facebook profile url, but I'm unable to get any images using the provider Id's im getting back from the dotnetoauth providers.
Twitter
provider user id: 126031206
provider user name: RogerAlsing
Google+
https://www.google.com/accounts/o8/id?id=somecode-alongercode
provider user name: my email
I've seen a few working examples, but they seem to use other IDs than I get here.
Is it possible to get the profile images using any of the above values?

This looks like the OpenID method of authenticating yourself to Google, and not the OAuth2 method that they currently suggest. (And if I'm reading correctly, it looks like an older OpenID method, even.)
Current best practice for Google+ authentication to get profile information is documented at https://developers.google.com/+/web/people/ and https://developers.google.com/+/web/signin/

In particular, for an authenticated user (https://developers.google.com/+/web/signin/), you can make a people.get API call, using the special keyword "me" instead of an ID. This will return the profile picture as part of a Person resource, including other profile information, as well as the Google+ ID. Also, to understand your Google+ ID, the proper link would be https://plus.google.com/u/0/ID/posts which is the link to your Google+ profile.

Related

how to get facebook user id or user name with email id

I am developing a MVC project where I am trying to get the user id or user name from the facebook by using the email id provided by the user,
actually i want to fetch the photo of the user, which can be done using
graph.facebook.com/user_id|user_name/picture
where as i have only have the user email id.
with a little surfing on net i found that user name or user id can be fetched by using
graph.facebook.com/search?q=emailAddress&type=user&access_token=ACCESSTOKEN
but i was not able to get the access_token.
Also referred
developer facebook page
and also this
Any help or direction to work will help indeed.
Basically i understand that i need a access token to get the details.
So how do i do this in my MVC application
As you can read in the Search API docs, you can only search for Users by name, but not by E-Mail. It may have been possible in the past, but it is definitely not possible anymore.
Also, for searching by name, you need to use a User Access Token. You only get one by authorizing a User: https://developers.facebook.com/docs/facebook-login

Spring Social: Get User (LinkedIn, Facebook) Email

I am using Spring Social to connect to LinkedIn and Facebook. I downloaded the source code from this link:
Github Spring Social LinkedIn Examples
In this project, I am running “Spring.MvcQuickStart” under examples directory. It works pretty well but I don't know how to get the user’s email. I need to know how can I get the user’s email in the controller given at this link.
I've added scope parameters like this:
parameters.Add("scope", "r_emailaddress r_fullprofile");
I can get the full profile of the user like this:
LinkedInFullProfile profile = linkedInClient.ProfileOperations.GetUserFullProfil eAsync().Result;
But the full profile does not contain user email (the email the user provided in his LinkedIn profile). I've no idea how to get the user's email.
The actual implemtation does not read email attribute, but you can get it using classic REST operations:
JsonValue jsonResult = linkedIn.RestOperations.GetForObjectAsync<JsonValue>("people/{~}:(email-address)?format=json").Result;

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...

Multi login problem using Twitter and Facebook Oauth

I am adding Twitter and Facebook login to a MVC 3 test application using TweetSharp and Facebook C# SDK.
Currently when a user signs in using Twitter I create a user account for that user in a user table and store the id, token, and token secret in a separate table with a foreign key to the user table. Since the id, token and token secret do not expire I can quickly locate the right user account when the user logs in next time using Twitter.
What if the very same user logs in using Facebook next time? Since Twitter does not provide email in their API and I therefore have no common piece of information to tie a user account to either Twitter or Facebook I assume I have to create a new user account for a Facebook login? Does anyone have any experience with this? Are there any ways to solve this?
I identify each user internally with a unique key. I check cookies for the user key when any user hits the site. If there's no cookie I create a new key. add it to the user database and set a new cookie. Once a user completes registration the first time by logging in with any of Facebook, Twitter or .Net membership , that key is forever married to that user.
So when an existing Twitter user logs in for the first time with Facebook, we know who they are because their user key exists. It is basically the same solution as macou suggested. Macou's has the plus of working on a new machine or if cookies are cleared, the cookie solution has the plus of not requiring additional user input.
Not really a solution, more of a work around. I was faced with the same problem and ended up forcing the user to complete thier account profile by asking for their email address before allowing them to proceed any further. This meant that if the email address coming back with the Facebook auth matched the email address created with the twitter signin then I didn't need to create another account.
The bigger difficulty was coming the other way, if the account was created by the facebook auth first. It meant an untidy marry up of accounts.
To be honest the information we got from allowing users to sign in with twitter was not worth the effort and in the end finished up only allowing Facebook auths. I'm not sure how important twitter is to your solution.
Not the perfect answer I know, but I thought I would share my experience.
You can't use just a cookie because I can login as facebook then my wife login as twitter using the same browser, you shouldn't link the two accounts in this case.
I think you need to do more than that:
Use a cookie then
Use name/first name/login name/... to see if they match.
Example:
Cookie id: 18459439731114330636, find user with id = 18459439731114330636. Found, go to 2, not found, go to 3.
Is username/first name/last name/... matches the current user? if yes, link accounts. if not, go to 3.
Create a new user.

RoR - How to obtain an access token for the facebook user using OAuth?

i want create something like "link_to" which can link to "request for permission" in facebook, so if user click "allow" then redirect to my site and i can get their data.
my question is how to create a "link" like that? so i can get access token from facebook user. (i had register my app)
thx..
Better explained here:
http://ggomeze.com/2011/05/19/post-to-facebook-from-rails-app
It's quite simple. Just redirect the user to the Facebook Auth Page:
https://graph.facebook.com/oauth/authorize?
client_id=...&
redirect_uri=http://www.example.com/callback&
scope=user_photos,user_videos,publish_stream
There're several optional parameters you can pass to get the required site.
For further Information just read the corresponding paragraph on the Facebook Documentation ("Authenticating Users in a Web Application"):
http://developers.facebook.com/docs/authentication/

Resources