Meteor Signup Code/Link for Facebook Accounts-UI Accounts-Entry - facebook

I am using the accounts-entry, accounts-ui, accounts-facebook packages and need to have the signup code feature for Facebook. Anyone successfully done this?
In it's simplest form, I just need a link (that I can dynamically generate) that will grant users access to my app. Then, on my homepage, I need a login button that will only allow those who have already gained access to my app in, and not allow those who don't have access. So basically a button that grants access to my FB "app" and a button that logs in only those who have access.

Create a new collection called "allowedUsers" or something. Add users to this collection who "click the button at a private link".
Then, on the Accounts.onCreateUser(func) callback, verify* that the user attempting to login using facebook exists inside the "allowedUsers" collection. If they don't, then just throw new Meteor.error(500, 'User isn't allowed to sign up through facebook') (an account is not created for the user in this instance).
See the documentation on Accounts.onCreateUser(func) for more details.
http://docs.meteor.com/#accounts_oncreateuser
*When I say verify, there are multiple ways to do this, but none are infallible to my knowledge. It would be up to you to determine if the person you added to your "allowedUsers" collection is truly the person signing up through facebook.

Related

How to make a Facebook Test Page have an Instagram Business account?

When you're trying to apply for Facebook Permissions for your application, you may encounter some permissions that requires App Review. In my case, I need to use the Facebook Login for Business Accounts, so I need to apply for Facebook's App Review.
In order to make an App Review for Facebook, you will need to provide step-by-steps videos and guides for Facebook testers to test for themselves. However, it does requires a Test User to do this.
A Test User can have a Test Page linked to it, and a Test Page is capable to link an Instagram Account created using this Test User. However, for some reason, I'm not able to convert this created Instagram Account as a Business Instagram Account using the Test User. I tried to link it using my application flow, but the "Convert to Business Profile" button does nothing, and if I try to do this in the Facebook Test Page account, the form that ask for Contact Information always throws a message "An Error Ocurred".
So, I'm unable to create an Instagram Business for testing and also not allowed to provide a real account because they don't allow this, as they explicitly says (Which I can agree with):
Note: Do not provide your personal Facebook account credentials.
As I'm unable to find a way around this, and I can't see to find any answer on the internet... I wonder if somebody could help with this one.
So, it seems it's just a Facebook bug (Just as one I was experiencing before this one, where after updating a Test Account permissions, the permissions were still not working properly) where the Test Account seems to be kind of locked in a state were you can basically do nothing more with it than what you have already done... So I end up creating a new Test Account and doing the same process, but this time it worked.
I had the same problem, and to fix it, I had to follow these steps :
Create a Facebook test user for your app.
Once the user has been created, click the three dots at the right, then edit its password, choose something that you will remember.
login as this test user.
Edit the user parameters and set its email address as main/default contact address (you need to type in the password of the user). It seems, by default, test user do not have default contact and this is required to login with instagram.
Now go to instagram.com, and create a new account using "login with facebook"
Fill in the name, password (you need to remember it), and userid.
Send the form, and you will get some error telling you to retry later. Ignore it, your account should actually be created.
Now switch to the instagram mobile app (web interface might not work, I was stuck in a redirect loop) so you can login to instagram using the email address of the facebook test user account (the one you used in point 4) and the IG password (you typed in point 6).
Hope it helps anyone stuck in this hell like I was for 2 days.

pyrocms social module: how to register new user with facebook connect

I'm still new to CI and PyroCMS, and am trying to implement a Facebook login using the Social module in a custom module, which looks like it does everything I want, but I'm clearly missing some basics (I can't find any documentation other than the brief readme)!
So far, I've watched the intro video, and have enabled Facebook successfully. I can connect via FB and see FB listed in /social/linked, but some confusion exists in my mind between the two user groups I've got: admin and user.
The flow I'm trying to construct is:
user arrives at the site and is presented with a survey
user fills in the survey, then is asked to signup (I understand that this is unconventional)
/signup has a facebook connect button, supplied by the social module
user clicks the connect button, and grants permission in facebook's popup window
user should be directed back to /signup, (or maybe redirected to /user/registration) with some details filled in from facebook (eg. email, name)
on submit, user should be added to the users table, as a member of the 'users' group (not admin) with no email activation required
an email is sent, thanks page is displayed
on returning to the site, the user should access their on-site profile using facebook connect.
I've read a bunch of threads on the subject, which have shaped these expectations...
Here's where I'm at:
user arrives, fills in survey, clicks the connect button
user is redirected to the homepage, which displays a standard page (not handled by my module). I need to return to /signup!
Based on this, I've tried setting:
$this->session->set_userdata('redirect_to', '/signup');
in what I believe is the correct controller method (checks to see if the user is logged in before sending the email, then calls template build to display the social buttons), to no avail.
(edit: I now see that the code above relates to the user module, not the social module.. maybe i can transplant some changes...)
My questions:
am i on the right track, or going about this the wrong way?!
am i right in thinking that the FB account will be matched with an existing user if the email addresss exists in the system?
I have only one FB account, which I is authorised for the app, and I'm using to connect with as a user - will this work, or do I need a separate FB account to test as user?
Other notes:
I am testing the site in Chrome, logged in as admin in Firefox.
Facebook is my testcase, I'm looking at supporting FB, LinkedIn, google and Twitter eventually.
Phew! Grateful for any feedback, Tim
I will try to answer some of your questions since i'm currently experimenting with the exact same social module as well and with some addons to it.
am i right in thinking that the FB account will be matched with an
existing user if the email addresss exists in the system?
Yes you are. I checked it myself while troubleshooting the fact that my google (gmail address) could'nt connect while my hotmail (registered email) could. You will have to sync your emails in all your social sites, change the loginsystem (allowing username login for example) or manually connect multiple emails in your account settings..
I have only one FB account, which I is authorised for the app, and I'm using to connect with as a user - will this work, or do I need a separate FB account to test as user?
I suggest u let someone with another FB account test the system (better save then sorry) but in my case I didn't have any troubles using other (normal) accounts to log in.
am i on the right track, or going about this the wrong way?!
This was your first question, but I'll answer this as the last on since I didn't test is myself:
The Facebook App has a setting called "Site URL". This is the url to which will be redirected. Simply change it to the page you wish it to be. You can also try to change the following lines in social/controllers/social.php:
Line 245 (redirect: user is logged in after FB connect)
redirect($this->input->get('success_url') ? $this->input->get('success_url') : 'social/linked');
Line 283 (redirect: user has to fill in some additional fields to complete registration)
redirect('users/register');
Good luck!
The intro video shows off the entire extent of the social module. Frontend registrations, frontend user account linking, and backend account linking for the entire system.
If you wish to integrate custom functionality, custom user flows and other stuff as listed in your question then you will need to do a little custom work with the module. Hack it, extend it, send in some pull requests, whatever, but sadly it cannot do "everything to integrate with everywhere ever" out of the box. :-/

Can Facebook users on a facebook app be anonymous?

I'm trying to create an app for closeted and questioning youth on facebook, and an important feature would be the ability to be anonymous on the app. I've been trying to find out if people can be anonymous on facebook, but this sounds like it's not allowed. Could facebook users make a new user account within a facebook app to protect their identity?
Thanks,
Colby
No, they cannot create a new facebook account from facebook app. And facebook has nothing to do with making a user anonymous, if user has given your application required permissions then you can have all the information about user, its up to you either you want to make that user an "Anonymous user" or show his profile pic/information.
Some suggestions:
In App Settings > Auth Dialog there is the setting Default
Activity Privacy which you should set to Only Me.
When a user authorizes your app store as little information as is
necessary, and prominently display your privacy policy explaining
what type of information you store, why, and how you will never
share it with anyone.
(optional) Store userids in your database as md5 hashes so that even if someone gains access to that database, they won't know who
the users are.

Making Friend Connections For Test Users

Using the Roles dashboard, I can create Facebook test user accounts but when trying to make them friends with each other via ticking appropriate accounts and then the 'make friends' button seems to do absolutely nothing.
I have then tried to make these accounts friends via the api call:
https://graph.facebook.com/{test user id 1}/friends/{test user id 2}?method=post&access_token={test user 1 access token}
This results in an OAuth Exception being returned:
{"error":{"message":"Error validating application.","type":"OAuthException"}}
This feature has worked previously for me (clicking the make friends button). Has anyone got any ideas on how to resolve this problem?
Apparently this was a bug, you can now go in via the modify roles menu in the application and select users to 'make friends'. This functionality is still pretty buggy but it does work eventually.
There is ui for it now which is helpful, the only bummer is that I also get the same OAuth exception as the original poster. It'd be nice to be able to do this with an API.
Now Facebook Resolve this from their End. Any developer can manually create a friend list for test user from developer console.
Follow the Below Steps:
Step-1: Login in Your developer console and click on you app project.
Click on Link to login: Facebook Developer Account Link
Step-2: Inside their you can see Roles click on their and then click on Test Users
See Below attached Images:
Step-3: Now click on Add to create number of test user. One Popup is display which you can see in below images. At their you have to mention test user permission which you want to perform.
For example, If you want to fetch list of test user friends then you need user_friends permission.
To get more link about Facebook permission/scope visit Facebook Permission Page
Step-4: Here in below image you can see list of test user which you created using step-3. Now you can click on Edit to add those other test user as friend of one another. for that you to click in Manage this test user friends and add other test user name in popup dialog.
Similarly you can also assign permission or remove test user once as per your requirement. This is it.

Facebook permissions

Suppose I have a website that wants to access a Facebook's user account information. Usually, the user is presented with all the permissions the website is asking for, and can either allow or deny them as a whole.
Is it possible to let the user choose (with checkboxes on each permission on the authorization screen, for example) which permissions he wants to give the website?
This would be possible but it would need to be done in two stages.
Firstly you would have to present the user with your own dialog where they can choose their prefered permissions.
Secondly you would have to authorise the user with the selected permissions via a Facebook dialog.
If you're looking for an example the Facebook Graph Explorer already does this:
http://developers.facebook.com/tools/explorer/
The bigger issue would be keeping track of the users available permissions and reacting according.
unfortunatly not out of the box. (but this could be changed sometime in the future, as FB displays a required next to the rights if you look on the rights you give to an app)
I used to ask the required prems, and let the user add optional perms via a click, which again opens the perm dialog but only with the perms the user not already give to the site.
for an example. user sign in form, beside the "Hometown" field i have a button "Fill from facebook" if user hasn'T given me that right to access user_hometown i call for the right and fill the form.
see this post for a good explanation on the why and how:
http://www.fb-developers.info/tech/fb_dev/jssdk/learning_jssdk_12.php