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.
Related
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.
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">
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!
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>
Can I get and show pictures of users through the Graph API with just the access token application?, for example collect the user information for show it in a same page, of course those users been accepted the permissions of the web app and then other user can access to the web and see the information of all those users. All this only storing the ids of facebook, I mean, for get in the same page the information of the users, I want to make a call through the API and retrieve his information by the facebook ID stored in database.
You can show public data of user using his/her user ID and Application Access token , which include name and profile picture.
https://graph.facebook.com/<user_id>
Submitting a GET HTTP request on above URL with correct user id will give you publicly available data. You can add fields to get more public data like profile photo.