Spring Social: Get User (LinkedIn, Facebook) Email - asp.net-mvc

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;

Related

How to allow access to logged in users email message while using Google plus sdk in ios?

I have got Google signin integration for my application. I successfully integrated it and by default i am getting username, usermailid, , user id and user authorization token id from sdk. Next thing i want is how to retrieve messages of Logged in user inbox. I went through the following links
https://developers.google.com/+/web/api/rest/oauth#authorization-scopes
https://developers.google.com/identity/protocols/googlescopes#replicapoolupdaterv1beta1
But still i am getting problems and confused in getting mail messages.
I think this is what you need
https://www.googleapis.com/gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}
And I strongly recommend you to use Google Playground to pick the exact API you are looking for

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

Correct way for sign up with Twitter Using Devise and Omniauth?

I am creating a rails app that requires sign up with twitter feature.And my application is based on email marketing service.Various types of email we will send user for the updates.
My concern here is that,twitter does not provide the email ID in response while authenticating a user via twitter API.
And now if I am creating that user in my database and allowing him to sign up by skipping some validation (Like email field is required). Then what should happen in the situation when my application will try to send the email to users.And this twitter user is not having email ID.
It will just skipped.
Is there any proper flow that I can use,so my app will work in correct flow.
Thanks!
Twitter doesn´t give you the email via API.
This works if you are using omniauth-facebook gem for example, but twitter doesn´t offer you the email - you have to create a workaround.
For example ask the user in a second step to fill in his/her email adress.

Get twitter and google+ profile images?

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.

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