Get user info via Google API for IP address - oauth

Is it possible to get information from user's profile via Google API? If it is possible, which API should I use?
I'm interesting in such information:
Url to the user profile
Gender (sex);
Profile photo.
Ip address wherefrom he/she login
I am getting other user information but How we can get IP address of the current session using google API ?
Currently I am giving SCOPES = "https://www.googleapis.com/auth/userinfo.email"
For getting userinfo I am using session.get('https://www.googleapis.com/userinfo/v2/me').json()

You should check out the Google+ API. Just so you know, it’s being deprecated, with a full shutdown in March.

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

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.

How to get the logged in user's email address with Yahoo Contacts API?

I managed to log a user in using OAuth. Then I can retrieve all the user's contacts by calling http://social.yahooapis.com/v1/user/me/contacts?format=json&count=max.
But I can't find a way to get the user's own email address. How can I get it?
I ended up using OpenID+OAuth in order to get the user's info with OpenID and the user's contacts with OAuth:
http://developer.yahoo.com/oauth/guide/openid-oauth-guide.html

Is there a way to get a user's email ID after verifying his/her Twitter identity using OAuth?

I am new to OAuth and have been playing around with the Twitter API. I am able to fetch the credentials of a user after authentication by making a request to http://api.twitter.com/1/account/verify_credentials.xml. The response contains the user id, screen name etc. but not the email ID.
Is it possible at all to retrieve the email ID of the user?
Update
I believe Facebook provides this information if you specifically request for extended permissions. Is there something similar for Twitter?
The user's email address can not be retrieved via the API. This is a deliberate design decision by the API team.
UPDATE 2015.08.18:
It is possible to request an email address from users, but it requires your app to be whitelisted. See https://dev.twitter.com/rest/reference/get/account/verify_credentials for details of the API call and this form to request whitelisting of your app.
For OutsourceFactor, which is written in Python / Django, I get the username via oAuth1, then construct an email as "username#twitter.com" which is guaranteed to be unique throughout twitter. Then I hash it to get a nice UUID to be used and associated with my local user account. Same thing for Yahoo. Google and Facebook use oAuth2 and they give me the email address on request which is nice.
To ensure multiple social associations with a single account, I allow social account associations ONLY after the user has locally created an account and is logged in.
So, you have to create an account first (local account), then you can use any of the social oAuth providers to ease your future logins. This is the best bang for the buck for my site.
Anyways, you get some unique form of ID from twitter. So just use it. You can ask for an email address later or before the association.
Email address is obfuscated by Twitter in their OAuth responses. Which always have been a great issue for people wanting to include a "Register with Twitter" function.
More recently (early 2015), Twitter have added email address support through a second service call, but under certain, abused, conditions.
https://dev.twitter.com/rest/reference/get/account/verify_credentials
So now it is possible, but my opinion is to continue to implement an OAuth every-provider-but-twitter single sign on. They must be boycotted until they act normally, i mean like every single other OAuth provider.
In Android using Fabric, I request the user's email address like this:
TwitterAuthClient authClient = new TwitterAuthClient();
authClient.requestEmail(session, new Callback<String>() {
#Override
public void success(Result<String> result) {
// Do something with the result, which provides the email address
}
#Override
public void failure(TwitterException exception) {
// Do something on failure
}
});
See http://docs.fabric.io/android/twitter/request-user-email-address.html
In my case every time I get the response I got a unique authentication id for every user and its same for that user every time. So I used that id to create a email like unique_id#twitter.com and check if that's already on my site ( for first time it is not ) and then register the user. Then if he logins second time I just again create the email and check if its already on there. By this I don't have to make him create a local account first and can identify him to login.
Here is the example how to get twitter user email in Laravel, and on coditty.com you can find the full example using Angular+Laravel
// get token secret from db
$token = TwitterTokens::where('oauth_token', $request->input('oauth_token'))->first();
// open twitter connection
$connection = new \Abraham\TwitterOAuth\TwitterOAuth(
$this->twitter_consumer_key,
$this->twitter_secret,
$request->input('oauth_token'),
$token->oauth_token_secret// twitter secret from DB
);
// get acces token
$access_token = $connection->oauth("oauth/access_token", ["oauth_verifier" => $request->input('oauth_verifier')]);
// new TwitterOAuth instance to get email
$twitterOAuth = new \Abraham\TwitterOAuth\TwitterOAuth( $this->twitter_consumer_key, $this->twitter_secret, $access_token['oauth_token'], $access_token['oauth_token_secret'] );
// Let's get the user's info with email
$twitterUser = $twitterOAuth->get('account/verify_credentials', ['include_entities' => 'false','include_email'=>'true','skip_status'=>'true',]);
// output user object from twitter in your Log file
Log::info(['user'=>$twitterUser]);
Who said it's not possible ???
I have gotten in my iOS App after whitelisting the App.
Check my answer here.
Add this code!
$params = array('include_email' => 'true', 'include_entities' => 'false', 'skip_status' => 'true');
`$data = $connection->get('account/verify_credentials', $params); // get the data`
// getting twitter user profile details
$twt_id = $data->id; //twitter user id
$twt_email = $data->email; //twitter user email
Checkout full procedure here.
Who says you cant get users email, the “Request email addresses from users” checkbox is available under the app permissions on apps.twitter.com. Privacy Policy URL and Terms of Service URL fields must be completed in the app settings in order for email address access to function. If enabled, users will be informed via the oauth/authorize dialog that your app can access their email address.

Resources