I'm trying to get a user's facebook profile picture based on their email address. Effectively, I want to offer my users the option between using Gravatar for their image, or Facebook. However, the only way I know of to get a user's facebook image is via:
http://graph.facebook.com/[FBOOK USERNAME]/picture?type=large
Since the usernames may vary between facebook and my site, I would like to do this via email address rather than username. How do I query for someone's facebook profile picture via email address?
I see this question has a couple of years already but the same search approach can be taken using the Graph API:
GET https://graph.facebook.com/search?q={EMAIL}&type=user
You can try this on the Graph API Explorer. You don't get the profile picture directly but you get the user id which you can easily use to get the public profile picture.
https://graph.facebook.com/{UID}/picture
There doesn't seem to be an official way to do what you are asking. It seems like facebook has made this closed on purpose, probably something to do with privacy. Its actually really easy to do this in a few screen-scraping steps though:
Visit http://www.facebook.com/#!/search.php?q=#{USERS_EMAIL_ADDRESS}&type=all&init=srp
If page returns "No results found for your query.", then they don't have a profile.
Otherwise, the page will contain a thumbnail of the user for that email address. (something like http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs227.ash2/48219_72120057_3223_q.jpg)
I could write a sinatra app to do this in about 5 minutes, if anyone would like me to.
But I think gravatar and facebook should just be friends.
What you're asking to do is part of why Facebook Connect exists.
Using their not-too-cleverly-named XFBML you can request the image directly:
<fb:profile-pic uid="1256100362" facebook-logo="true" size="thumb"> </fb:profile-pic>
But you have to implement logins with FB Connect first...
Related
I know I can get it with a Google+ user ID, but I don't have that, I just have the users' email address. I don't want to make them login with their Google account.
Is it possible to get the photo? I'm thinking not, but I just wanted to make sure. Here's the most info on it I could find:
https://code.google.com/p/google-plus-platform/issues/detail?id=64
As the feature request says, there is no way to look up a Google+ profile via email address. Since the only way to get a profile's avatar is by looking up their profile, there is no way to get a profile's avatar via email.
Gravatar might be a better fit for what you are trying to do.
You can get their name and profile photo with avatarapi
The new Gmail API allows us to create and view drafts, but is there a way to get a URL link to view the draft?
I can manually create the link using the draft's ThreadId with something like this:
https://mail.google.com/mail/u/0/#drafts?compose={ThreadId}
But that is somewhat fragile if Google decides to change how those URLs are structured. I also don't know if the URL will be different for people in other countries. The 0 will also change depending on how many accounts you are logged into in the browser. Is there a better way to get this link than creating it manually like I am?
Also, is there a way to pass authentication information along with the URL so that user is logged in when going to the webpage? I'm assuming that there is no way to do this, but I wanted to check. If a user is not logged in, the draft link brings up the login page and the draft is not displayed after logging in.
No, creating the URL manually is currently your best option. You can drop the u/0/ if you want and Gmail will automatically use the first authenticated account.
No, there is not a way for you to automatically sign a user into Gmail.
For exposing URL to a draft created by API, this works:
...
final Gmail.Users.Drafts.Create request = gmailService.users().drafts().create("me", content);
final Draft response = request.execute();
final String url = "https://mail.google.com/mail/ca/u/0/#drafts/"
+ response.getMessage().getThreadId()
...
When the user clicks on it, gmail will translate (and redirect) to a different URL, but opens the correct draft.
I however did not find mention of this in the docs, so it might be an unsupported feature that stops working one day.
Credits: #Chris Wood from this SO question stackoverflow.com/q/50124112/455449 (see his comment below question)
Concerning passing authentication info:
passing account id is probably not possible
passing password in url would be a security nonsense (so I trust it is not possible)
I have a google calendar that I have marked as shared. it stores all appointments for the day.
I have a webpage. from the webpage, the user enters a date and I use the google api (javascript) to pull back all info from my shared calendar for that date and present it to the user.
I also want the user to be able to make appointments during free times on any given day.
problem is, I must be signed in to my google account. if I am NOT signed in, I get a little popup asking for my userid/password.
how do I get rid of that? I had hoped that making the calendar shared and specifying the client ID and api key (assigned via Google's API Console) would have been enough.
I've run across this: http://cornempire.net/2012/01/08/part-2-oauth2-and-configuring-your-application-with-google/ which explains doing this via Oath and refresh tokens in PHP.
unfortunately, I'm doing this in javascript and MUST do it from the client side. is that possible?
I think you should look into using a service acccount for this.
http://code.google.com/p/google-api-php-client/wiki/OAuth2#Service_Accounts
By using a service account you wont have to worry about people loging in. They will have access to the calender for the service account.
Update: I have searched for examples of how to do this in Javascript and have been unable to find any. After considering this issue for a while now i have come to the conculsiton that even if you could use a service account via javascript for security reasons its probably not a good idea.
Unfortuantly this leaves me to beleave that the anwser to your question is No. You cant do this client sided. If you use normal OAuth2 its still going to prompt you for the autentication. You need to try and reconsider a server sidded option. PHP for example
I am using a facebook php SDK to post image to users album using the user access token. First we will generate the token and then post the image. My issue is that posting image works fine but below each image on right side, facebook adds a link 'via MY APPLICATION NAME'.This link redirects user to my application page in facebook (http://www.facebook.com/apps/application.php?id=APPLICATION ID). I want to change this link to point to my personal website URL (www.abc.com).
Please let me know if this is possible.
I've seen other apps do it, and am looking for the same thing. I've glanced over all the app settings, and am currently reading the api trying to figure it out. It's probably going to be something stupid like deleting all the other urls to force it to default to your site url in the app settings...Let me know if you have any luck with this.
Hey everyone, I am sorry if this question has already been asked/answered
But I have a Cocoa program that has different arrays of models. Each model hold just Strings and one Image. Archiving and Loading works great.
Each model represents a web account, that is, it holds the username and password, and some other information related to the website. Moving forward I would like to be able to update information in each model by accessing the information from the website. For example updating a balance ($). I am wondering if there is a way to do that programatically that is:
Automatically log into web account using the entered username, pass, and website url
Update the balance based on the information following log in.
Thanks for the help in advance!
Tamara
There is no single approach to log into any arbitrary website. You will need to know what the API for the given website is. If the website provides a web service to query things like balance, then you would connect using that web service (REST-based if at all possible; SOAP is more of a pain in Cocoa), and update your model based on the results. If the website provides no web service, then you would have to scrape through the HTML responses looking for what you want, and this is generally very complex and fragile. There is no general answer to this question; you'd have to know what form the website is in.
On another note, make sure that you are not storing user passwords in unencrypted files. User passwords on Mac should always be stored in Keychain. There are many posts on SO about how to best use Keychain.
Rob, isn't it possible to just look through the login page's html source and see what are the names of the fields for user and pass, and then just send a POST request to that page from code ?