Fetch current location of a Google Plus user's contact - google-people-api

I would like to access the location of a User's contact.
Given, that the user is authenticated and the requested contact has granted access to his location data (Location Sharing).
This is basically the same thing as in the Google+ Android App under "Locations" or in the web app, when you open the "About me" information.
I searched the People API, but apparently the "getCurrentLocation" method does not seem to provide that information anymore (delivers NULL).
Thank you for your hints and tips

Related

Using facebook graph api to read photo tags

I am building a website using React and Redux to search facebook photos through tags like my Friends name or by location. User needs to login with facebook so that the application can read its pictures. A user simply puts in the search filters like Tagged users or the location of the picture and my app will show results based on the filters. This will help to find old photos with friends which sometimes get lost on social media due to a large number of photos present(Uploaded or Tagged)
I am trying to fetch mutual photos of me and my friends using my access token and trying to read the tags present in the photos through API but the Response contains only my name in the tags and not other people who are tagged in that photo.
Is there any way to fetch the users who are tagged on a photo uploaded? Any help is appreciated.
Graph api link
Access to any data involving your friends is only possible if those friends specifically authorized your App too. You cannot even get an ID of a friend if he did not authorize your App.
Yes, in order to access involving your friend to authorize your app. But from the details i can see that,
"A user access token may read a photo that the current user is tagged in if they have granted the user_photos or user_posts permission. However, in some cases the photo's owner's privacy settings may not allow your application to access it."
Note: Just need to verify users privacy setting once again.

Getting addresses from iCloud contacts via CloudKit JS

I want my web application allow to import user contacts (particularly addresses) from iCloud contacts.
Something similar to what Google People API provides for Google Contacts.
The scenario is that, a user comes to my site using a desktop browser and imports all their contacts.
So the user should not waste time on typing all their contacts to be able to use them on the site.
I'm trying to use CloudKit JS for the issue.
It looks like .discoverAllUserIdentities is what I need according to this:
GET users/discover: Fetches all user identities in the current user’s address book, described in Discovering All User Identities (GET users/discover)
However, I'm getting the empty set:
{"users":[]}
It seems like the web application doesn't have the permissions to get the contacts. If it's so, how to request the permissions?
Or may be I'm on completely wrong way, then please point me on the right direction if the issue is solvable.
Updated Answer
Since you're not building a native web app, you can't request access to a users iCloud contacts. This would be a security nightmare if websites were allowed access to users data. There are tools like ShuttleCloud that offer an API for migrating users contacts. This is what Google uses for their own Gmail service.
So no, you can't request direct access to contacts through the browser, but there are tools out there to make importing things easier.
Old Answer
You need to ask iOS for permission. You can do so by viewing Apple's documentation.
Example
#import <AddressBookUI/AddressBookUI.h>
// Request authorization to Address Book
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
if (granted) {
// First time access has been granted, add the contact
[self _addContactToAddressBook];
} else {
// User denied access
// Display an alert telling user the contact could not be added
}
});
}
else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) {
// The user has previously given access, add the contact
[self _addContactToAddressBook];
}
else {
// The user has previously denied access
// Send an alert telling user to change privacy setting in settings app
}
Document from apple:
Discussion
Use this method to retrieve information about other users of the app. This method returns information about those users who meet the following criteria:
The user must be in the current user’s address book.
The user must
have run the app.
The user must have granted the permission to be
discovered for this container.
Guide of discoverAllUserIdentities

Can I use Pages to authorize on my website in the same way Facebook Connect does?

Is there any way to authorize user (acting as a Page or Page administrator) in the same like FB Conect does but using Page data?
E.g. I would like a company, say local barber, authorize in my system as a certain Page (can be indirect, i.e. through a private account but I would like to know if this user is a page administrator). The purpose of this is to link an account on my website with a certain business that has representation on Facebook.
Well, you could ask the user for manage_pages permission and look if the page you’re interested in is amongst them, but since that’ll give your app also their page access tokens, I doubt they’ll grant you that.
Less intrusive and much simpler would be to have them install your app on their page as a page tab, and then look into the signed_request parameter once their using your app - it has a boolean flag for wether the user is admin or not. After that they can remove your app again.

Posting photos to a Facebook page as a non-admin

A client wants the ability for people to upload photos from within their website and have them post to their Facebook page. I'm personally an admin of the Facebook page in question, so I can post the photo myself without issue. However, I'm trying to determine if there is a way for a non-admin to post a photo to an album within the page.
Originally, there was an offline_access scope which would allow me to get a single access token (logged in as myself) to be used on the third party website, but this is no longer the case. It's looking more and more like there is no way to write any kind of information to a Facebook page (including wall even wall posts) via the open graph api unless you're an admin and have a manage_pages enabled token.
Any thoughts?
You shouldn't need manage_pages permission. You want publish_stream.
manage_pages just allows you to obtain an access token to "log in as" an admin to a page the user has access to. Publish stream allows you to make comments and post on people's wall.
With publish_stream, you should be able to post pictures to the pages wall as long as that page's permissions allow you to do so. You won't be able to upload them to the pages album though, as that needs to be performed by an admin to the page. Just like your friends can post pictures to your wall, but they can't add photos to your albums.
Using the graph protocol, you can perform any action that both:
The user you're authenticated as has permission to perform
Your application has been granted permission to perform on the user's behalf.
So it's important to understand both the permission settings of both the actor (authenticated user) and the victim (the object being changed).

How can I allow my users, who create pages on my website, to communicate back to those people who click the Facebook "Like" button on their pages?

OK, apologies for the verbose title. Let me give the background in a bit more detail.
My website allows my registered users to create new pages, each of which has its own unique URL. Each page has a Facebook "Like" button on it. I've already implemented Facebook Open Graph API meta tags so that the pages are proper open graph objects, and when some other visiting Facebook user "likes" the registered user's page, a post appears on that Facebook user's wall saying they have liked the page. The Facebook Like widget also displays the number of "likes" that page has received as normal. So far, so good.
What I want to do is allow my registered users to be able to communicate back to the Facebook users who have liked their page. The community of "likers" for a page is a potentially valuable social media resource to the registered user, if only they could communicate back.
I am aware of the "admin page" link you get beside the Like button, which can be used to post to these people, but that is not an option for my registered users as they have no privileges in relation to the Like button.
What I want to do, if possible, is setup a form to capture the registered user's message back to the Facebook users, and then my website sends the message on their behalf, without having to ask for any extra privileges from the Facebook users.
The following Facebook documentation pages seem to say this is possible, but having followed the Open Graph API documentation, I can't get it to work as described - http://developers.facebook.com/blog/post/465/ and http://developers.facebook.com/docs/reference/api/ ("Publishing" subsection). I can get the access token correctly in the first request, and plug that into the second request to do the post, but that doesn't seem to do anything and doesn't return any error.
Since it doesn't work for me, I'm wondering if this is possible as described, or do I need to get some sort of extra permission to do this? I've seen reference to offline_access permission but as I'm new to this stuff I am not sure how it would fit in. If I have to get the Facebook users to grant permissions, this is not going to work as envisaged.
Any thoughts would be most helpful.
The short answer: No, You will never been able to post on someones wall as another user.
The long answer:
You could try to ask for offline access but then you are asking the user to hand over all their facebook data and give you access todo whatever you like their accound, so that is not likely to happend.
The next problem is that they have to be friends to be able to post on each others walls.
Thats why Pages was implemented, so that organisations could announce/talk with the people interested.
However if you have created the like button correctly and give the pages correct meta data, you are able to post to user who have liked it.
Scroll down to Publishing:
http://developers.facebook.com/docs/opengraph/
Just add a form for your user and let your system publish to the correct page, you probably will need a offline token from your own account or similar to use on the server.
Another more complex way could be to generate a facebook page for each page you have on your server.
When the user creates a page on your system a page is created on facebook but as your app as admin.
And when another user likes the page they like the facebook page, hence you have the possibility to post in that page and speak to the user who liked it. (whooa thats a mouthfull).