What is the Google API URL to user data? - url

After authenticating with OAuth2 and get the access token, the next step is get Google API URL to user data.
The Facebook API URL to user data is basically https://graph.facebook.com/me/ or https://graph.facebook.com/{user-id}/ depending on the case.
On Google+ what is the URL?
I need to get data as the user name, profile photo ...
Thanks!

Use the new people.get() with userID=me. Make sure you have sufficient oauth scope to do so.

Related

iOS, REST API - Facebook login

I'm studying how to develop an iOS app and I need to figure out how should I structure it.
Architecture:
I've an external database, a REST api (as interface between the database and the app), and the iOS app.
The question:
I'd like users to authenticate by a simple form or by a Facebook login button but in each case a table 'user' in the database has to be filled with default fields like name, surname, email, profile picture, password(?).
For the standard authentication there are no problem, but for Facebook authentication I'm quite confused about theory:
Should I use access token? How?
When a user get authenticated with Facebook I haven't his password, so how can I get his informations from the database? In the standard way I would give to the database username and password and it would return for example the id field.
Sorry for my english.
You can use the access token of current logged in user
[FBSDKAccessToken currentAccessToken]
and send it to your REST api. From there you can retrieve every information you need and save it to your database (except user's password of course). If a user sign in for first time in your app insert a new user in your database and save user's Facebook User ID.
The whole idea of using authenticate and authorization is not to have access to user's password of another app, but the user authorize (confirm) your app to have access in his/her account with specific permissions.
Here is a step-by-step answer of what you need:
Design for Facebook authentication in an iOS app that also accesses a secured web service
You need to save the currentAccessToken that the login request returns to you.
Then, using Facebook's Graph API, the userID that was returned in the login request, and the user access token, you can request a user object, which has the email address, assuming you added the email permission in the login request.
Also use the Graphi API to retrieve the user's photo using the userID that was returned in the login request:
50x50 pixels
<img src="//graph.facebook.com/{{fid}}/picture">
200 pixels width
<img src="//graph.facebook.com/{{fid}}/picture?type=large">

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!

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.

How to get public posts of facebook user based on facebook url without authentication

I am working on asp.net mvc. I am trying to search public facebook posts of a user by the facebook url. i.e. I have a textbox in my webpage in that user will enter his facebook url like https://www.facebook.com/xxx.yyy and based on that url i need to find particular user and needs to display all public posts of that user. I have tried with open graph api like,
https://graph.facebook.com/search?q={username found in url}&type=user
but it asks me accesstoken. I will get accesstoken only when user was login to facebook but i need to display user's public posts without asking him for authentication. Please guide me.
You don't necessarily need a User access token to get result from https://graph.facebook.com/search , you can use your App Access Token to retrieve the result.
You can also use the same App Access Token to query the public post of the user by calling to Facebook's end point like
https://graph.facebook.com/<user-id>/posts
Where is the value specified in your textbox as
https://www.facebook.com/<user-id>

Foursquare OAuth Request from Rails Console

I've been storing the profile url for users that authenticate with Foursquare like this: foursquare_url = "http://foursquare.com/#{access_token.info.nickname}"
It seems that Foursquare stopped providing nickname in the access_token, so now I save the url like this: foursquare_url = access_token.extra.raw_info.canonicalUrl
The issue is that some users authenticated before I made the change, so they all have 'http://foursquare.com/' as a profile url. How can I loop over those users and store the correct url?
Thanks!
In order to make a request on a user's behalf, you need to use their access_token. If you don't have those stored in your database, you'll have to capture it the next time they authenticate your site and fetch the needed information via the foursquare API.

Resources