In my app I need to find a way to connect users with their facebook ids (or something, that will identify them later). Will try to explain:
As a user,I'm create an event, and mark participants by enter their names.
Some of participants are already sign up in my app, some of them not.
To identify participant (no matter, registered or not),I have planned to use their facebook ids. Currently,I want add links to their profiles under names.
So, is there a way to get facebook id of user, by his profile link (https://facebook.com/zuck)? Or any other way to identify user via facebook, no matter registered he in app or not.
UPDATE Looks like there are no way to use facebook IDs for this task. Maybe there are another identifier to uniquely link account with facebook?
Related
Let’s say BIM360 admin has added my BIM360 app from BIM360 App Store to his/her BIM360 account, and gone through the provisioning steps.
After that, when user clicks ‘Open’ link (a sample shown in the screenshot), a page from my app will be opened.
In this page, I need to determine whether this particular BIM360 account already has a corresponding account in my app or not.
To clarify further, my app is a multi-tenant cloud-service, and each tenant/account is tied with a BIM360 account - not with individual BIM360 users. So, regardless of BIM360 user who logged into BIM360 page, I need to redirect him/her to the account corresponding to BIM360 account.
If no corresponding account in my app (which will be the case for first time access), I have to redirect user to 'sign up' page.
Question: how do I find the BIM360 Account ID when user opens my app via 'Open' link in BIM360 page?
One possible workaround (a hack, really) is to use ‘referrer’ in HTTP header (on my page) to grab the URL of BIM360 page, and scrape Account ID out of it.
What is the correct way to do this? Could you point me to a sample code?
Thanks
When the end-user opens your app you should ask to sign in with his/her Autodesk Account, which results in a 3-legged OAuth access token.
With that, your app can call GET Hubs, which returns the list of Hubs that user has access and your app also has access. As this includes all hubs, check for attribute.extension.type == hubs:autodesk.bim360:Account and the hub id will be the BIM 360 Account. You may also check the hub id with b. prefix.
Please note the Hub id has the b. prefix and you need to remove it to get the correct BIM 360 Account ID.
Finally, an end-user that comes to your app may have multiple BIM 360 Docs hubs provisioned to your app, e.g. a contractor that works with multiple projects, so consider that scenario.
Check this article for some other considerations.
EDIT
From comment (23/4/2018):
the workaround you suggested doesn't really solve the problem then. I need a way to figure out the BIM360 Account ID for the page where user clicked 'Open' link.
After the user clicks on "open", your app needs to ask for sign-in, which gives your app a 3-legged token. With that, call GET Hubs endpoint, filter hubs for BIM 360 Docs, if more than one, ask user to select the hub/account, then you have the account ID.
I am building a login system that depends on Facebook login plugin (https://developers.facebook.com/docs/facebook-login/web). Everything is going well with this easy to use plugin. The bad news is that: today, I noted that the Facebook changes its user IDs, and these changes can deceive your login system.
Explaining the process and the problem:
1- The user goes to your website and click Facebook login button to access to your website.
2- The plugin grabs the user's information from Facebook API, including the user Facebook ID.
3- Your script uses the grabbed info to check your database, looking for the Facebook ID in the users table.
4- If the Facebook ID exists, the system allows the user to login. If it does not exist, the system creates a new account for the user and login him/her to your website.
So, the same Facebook user might be registered more than one time as long as the Facebook changes the user's ID.
As I noted today: Sometimes, the Facebook gives its user an ID with 9 digits, and other times give the user an ID with 19 digits. If you used any of those IDs; it would redirect you to the same user's profile. For example: if the user's IDs are 999999999 and 1010101010101010101
https://facebook.com/999999999 and https://facebook.com/1010101010101010101 both URLs will lead you to same profile.
P.S. The script checks with the user's email, however the user has the choice not to supply his/her email address to your website.
I use API v2.. I didn't use the old version (v1.). So, I think this is not the issue of chronicle or app scoped IDs.
If you have any ideas that help in getting a fixed Facebook user ID, please let me know.
Thank you in advance
I recently came across StrongLoop and am thinking of porting my existing app to it. However, I am unable to wrap my head around how the following scenario can be catered for:
My app is supposed to have two distinct regions Retailer and Customer. The UI and functionality for Retailers is very different from that for Customers.
The users, on the other hand, can have the roles Retailer, Customer, and even both Retailer and Customer. So when a user tries to log in, I check what roles she has assigned. If she has a single role, I redirect her to the appropriate section of the site.
If, however, she has multiple roles, I need to present her with a list of roles assigned to her where she needs to make a selection what role she wants to assume for this login. If she selects Retailer, I should redirect her to the Retailer section of the app where she should only be able to post products (let's say). If she selects Customer, I should redirect her to the Customer section of the app where she can only view the products posted by all retailers.
In a StrongLoop world, is there any way I can achieve this?
So I've been trying for this for a couple of days, trying to figure out how to use Facebook's Graph API v2.2 to get mutual friends between two users. I understand that I can only get the mutual friends between two users that are using the FB App and that's cool.
The app has the following approved items:
email
public_profile
user_birthday
user_friends
user_hometown
user_location
user_relationships
user_website
My scenario is this:
A user (user A) register to the FB App
Another user (user B) registers
User A looks at the user B's profile
The profile should display the mutual friends between the two users
I've tried to play around in the Graph API Explorer
/v2.2/app_scoped_user_id?fields=context.fields%28mutual_friends%29
and
/v2.2/user_id?fields=context.fields%28mutual_friends%29. These just returns an ID field with the ID I provided and nothing else.
I'm all out ideas, and the docs isn't helping much either. Can someone explain how to do it?
I will be using it in an Angular app but as long as I can get the URL to fetch the correct thing I can translate it into Javascript.
For v2.3 - https://developers.facebook.com/docs/graph-api/reference/v2.3/user.context/mutual_friends
Between friends make sure the user_id in the query is the Facebook id of the other friend not the current user whose access token you are using.
GET /v2.3/{other_user.user-id}?fields=context.fields%28mutual_friends%29
For querying mutual friends between two non-friends you need to add a server appsecret_proof parameter plus the user access token.
I'm going more in depth in the Facebook javascript sdk but I am still new to it. I would like to display for every user on my website who logged with Facebook, their friends' pictures who also authorized the app. It is clearly and simply possible by using PHP SDK, but I only want to make use of javascript SDK to improve the speed of my site. Does anyone have an idea ?
Best,
Newben
You can use FQL to query the current user's friends SELECT id, name FROM user where uid IN (SELECT uid1 FROM friends WHERE uid2=me()) AND is_app_user=1. This query does two things. Finds all the friends and find only the friends who have your app installed.
For additional information see:
http://developers.facebook.com/docs/reference/fql/user/
and
http://developers.facebook.com/docs/reference/fql/friend/