Thursday, December 01, 2011

How to create test accounts in Facebook

Hi All,

Facebook now doesn't allow you to test your facebook application without creating test accounts. When you try to test your non published Facebook application and try to post any update you will get this error message:

oAuthException #100 can only call this method on valid test users for your app

To create a test account in Facebook, here is the steps:
1) Copy and paste the following url in your browser:


https://graph.facebook.com/151284171604933/accounts/test-users?
  installed=true
  &name=MYNAME
  &permissions=read_stream
  &method=post
  &access_token=YOUR_FB_APP_ACCESS_TOKEN

Before hit enter, do the following:
a) Get the access token for your facebook application, to get it paste the following url in the browser:



b) Permissions: To grant certain permissions to the test account, read the full extended permissions from below link:

https://developers.facebook.com/docs/reference/api/permissions/

If you get an error when you specify a name, you can omit the name parameters and in this case FB will create a name for your test account.

Once you edit above parameters and hit enter in the browser, you will get a message like this showing that your test account has been created successfully.

{
   "id": "XXXXXXXXXXX",
   "access_token": "XCEWWEE#######EEEEEU8ffOT3VYD70ld0nYCiNlZB5Flmh59yfPksO5XfUdVxnZAhi0oEKvpJxACywhxsNgwGWfe6gH2B1DaxVUSXy2mCfo1jzf3TUk7",
   "login_url": "https://www.facebook.com/platform/test_account_login.php?user_id=3232334444444449&n=oWKUdwdw5xdLx0a2CBW",
   "email": "cqszpqv_smithwwwqitz_133222765997\u0040tfbnw.net",
   "password": "211212121233"
}

Try to log in with the username and password before run your application.




Hope this helps.

* References:
- How to create test users in Facebook:
https://developers.facebook.com/docs/test_users/