Good morning all,
I must create a site in PHP where we enter the url of the facebook profile, and then it must retrieve some information from the profile:
The profile picture
The name
If the profile and verify
I wish I could do it without this connection.
What to give me a clue?
(I succeeded with tiktok, instagram, etc.) but with facebook it's been a while that I'm looking for the solution
This is not possible for 2 reasons:
Scraping is not allowed on Facebook, you must use the API for accessing any data
Any user data is unavailable with the API, unless the user authorizes your App to access his data
The correct way to implement verification is to implement login with the Graph API and let the user authorize your App. Btw, this still does not mean you can verify his profile url, because you will not get the real URL, not even with authorization.
Related
I am implementing the web service for mobile phone(Like ios, adnroid etc). I dont have login/signup through facebook in my App. But i want to share the data from my App to facebook (and twitter ) as a post. For this, i dont want to redirect user to facebook to enter their credentials on facebook and then share the data. My requirement is get only Username and password from the user save it in DB and call the FB API from my webservice which will check for the authentication of the user credentials (Facebook ) and if correct then it will psot the data / message to user FB wall. I am trying with php for this , but all the libraries and codes available, are going for FB login window.
I know that offline facebook access is removed, but still want to go for it.
Please, one guide me for this. Any code for php or code for mobile (Iphone and Android) will work
You can´t use the api with only username and password, that would be a major security problem. If someone hacks your database > access to all Facebook accounts.
That being said, you don´t need to authorize a user for sharing, the Facebook docs offer a lot of information about that topic: https://developers.facebook.com/docs/sharing
You can just use the native share dialogs. For posting without a dialog, you would need to do a lot more things:
Authorize the user with the publish_actions permission
Go through a review process on Facebook with that permission
Use /me/feed to post: https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed
And keep in mind that the message parameter must be 100% user generated, see platform policy: https://developers.facebook.com/policy/
2.3 Ensure that all content in the user message parameter is entered by the user. Don’t pre-fill. This includes posts, messages, comments,
and captions.
A generated message will not get you through the review process.
Hi guys I understand how to retrieve the ACCESS TOKEN by requesting the permission to access a client's instagram but I'm trying to avoid exactly that.
I need to be able to get someone's last picture without requesting to authenticate on instagram to the client.
There has to be a way with the api to fetch that picture while using OUR instagram account and not the client's instagram is there not?
I don't want to have to hard code a connection and html scraping!
Please enlighten me and sorry for my bad english!
TL;DR: I want to use my client id, client secret or username/password of my instagram account to view another user on instagram's picture!
You can use your access_token to access other user's instagram photo feed API. As long as that user is not private. You cannot use client_id for accessing any user information, you have to authenticate and use access_token. This API call will work for, just replace the user_id you want to access and use your access_token.
https://api.instagram.com/v1/users/USER_ID/media/recent/?access_token=ACCESS-TOKEN
Basically, I'd like my users to be able to register and log into my site using their Soundcloud accounts (much like Google or Facebook).
But I'm following the login flow from their docs (http://developers.soundcloud.com/docs#authentication), and I understand how to redirect them to the Soundcloud connect screen to authorize my app. And from that, I get a code that I can exchange for an access token. But after that the docs state this:
You should now store the access token in a database. Associate it with
the user it belongs to and use it from now on instead of sending the
user through the authorization flow.
So they're assuming that I already have registered users who then connect to Soundcloud through some other function of my app. But what I want, is for them to be able to create their account from their Soundcloud user info. I think this is initally possible, but when they return to log in again, I need that access token to identify them. But I can't get that access token without sending them through the auth flow again.
I'm guessing what I want to do can't be done, but it's also possible I'm overlooking something. Any help would be appreciated!
I've done this with IMGUR OAuth2 API. After you get the access token, make a new request to their /me endpoint. This way, you'll have the SoundCloud id for that particular user. Now you can check if you already saved this user in your database. If you have, just save the new token to make sure this user has granted your app access to their SoundCloud. I'm not sure if I were clear enough. Let me know if you need any further help .
I am always reading about Facebook and Twitter logins for someones website.
The integration using one of theses services is okay, but my questions is how can I access both API´s for one user.
Example:
User is logged in on my website (active session). Now he somehow has to grant me access to his user details etc. on facebook AND twitter. How do I realize that? I don´t want him/her to type in his facebook or twitter credentials everytime he logs in to get his access token (oAuth).
How do I get my own oAuth user access token after using my websites login, so I can interact with Facebook and Twitter´s API.
Is this correct?
Thank you very much, if you can help me.
Facebook
When someone logs into the Facebook account, they stay logged in until they actively log out.
The way to test for this is:
FB.getLoginStatus(function(response){
if response.status === 'connected'{
// The user is logged in
var access_token = response.authResponse.accessToken;
// Do whatever you need to do
} else {
// Get the user to log in
}
});
See here for more details:
https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
Twitter
The process is a little more complex for Twitter, but if you only want to display tweets, consider Web Intents.
Otherwise, follow these steps:
https://dev.twitter.com/docs/auth/3-legged-authorization
Both platforms have the ability to check whether or not the user is logged in first, so you shouldn't have to worry about someone having to log in every time they use your site. However, you cannot use the same oAuth token on both sites - you must get a separate one for each.
Each individual API will need a popup to authenticate, which will redirect to the appropriate api for authorisation, and then once you have the token after the authorisation redirects back to your popup.
You will then end up with a token that you can pass back to the calling page "window.opener" and store the token for that api in a Javascript variable by alling a Javascript funcation on the main page.
window.opener.getInstagramData("self", oauth_token);
Each authentication needs to have its own token and needs to be a button that the user should click on.
I am using this method to get Facebook, Twitter, LinkedIn Foursquare and GooglePlus account info.
Hope this helps.
I am integrating GFC with my web app (PHP). In this app I have a list of user IDs and I need to fetch their profile details like their display name, profile pic url etc. using a HTTP call.
For example, I am trying to fetch data of user with id: $userId = 1234567
If a viewer (need not the user with above id) is logged in, I am able to fetch data by making a call to following URL.
http://www.google.com/friendconnect/api/people/$userId/#self?fcauth=$fcauth
But, if viewer is not logged in, the above URL replies the following
Anonymous requests are not allowed to fetch data
Error 401
I would like to know what URL should be used to fetch the user data even if no one is logged in.
Thanks!!
The fcauth mechanism is designed for access while the user is online. The fcauth tokens expire fairly rapidly, and no guarantee is made about how long they're valid for. You should assume that they'll only work while the user is online.
If you need offline access, you need to use OAuth. OAuth tokens are valid until manually revoked.
The API call you're making is the correct one, you just need to do it with OAuth instead of fcauth.