{"id":13834280,"url":"https://github.com/Wizcorp/phonegap-facebook-plugin","last_synced_at":"2025-07-10T04:31:57.323Z","repository":{"id":1533627,"uuid":"1824050","full_name":"Wizcorp/phonegap-facebook-plugin","owner":"Wizcorp","description":"The official plugin for Facebook in Apache Cordova/PhoneGap","archived":false,"fork":false,"pushed_at":"2021-01-03T18:26:18.000Z","size":75734,"stargazers_count":1911,"open_issues_count":431,"forks_count":1998,"subscribers_count":123,"default_branch":"master","last_synced_at":"2025-06-28T15:09:16.344Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"crayfellow/openfl-tools","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wizcorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-05-31T01:02:23.000Z","updated_at":"2025-06-10T22:13:58.000Z","dependencies_parsed_at":"2022-08-16T13:40:19.646Z","dependency_job_id":null,"html_url":"https://github.com/Wizcorp/phonegap-facebook-plugin","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/Wizcorp/phonegap-facebook-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wizcorp%2Fphonegap-facebook-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wizcorp%2Fphonegap-facebook-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wizcorp%2Fphonegap-facebook-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wizcorp%2Fphonegap-facebook-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wizcorp","download_url":"https://codeload.github.com/Wizcorp/phonegap-facebook-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wizcorp%2Fphonegap-facebook-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264528741,"owners_count":23623218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T14:00:22.765Z","updated_at":"2025-07-10T04:31:54.720Z","avatar_url":"https://github.com/Wizcorp.png","language":"Java","funding_links":[],"categories":["Java","III. Network and Integration"],"sub_categories":["10. Integratin with API"],"readme":"# Apache Cordova Facebook Plugin\n\nThis is the official plugin for Facebook in Apache Cordova/PhoneGap!\n\nThe Facebook plugin for [Apache Cordova](http://incubator.apache.org/cordova/) allows you to use the same JavaScript code in your Cordova application as you use in your web application. However, unlike in the browser, the Cordova application will use the native Facebook app to perform Single Sign On for the user.  If this is not possible then the sign on will degrade gracefully using the standard dialog based authentication.\n\n* Supported on PhoneGap (Cordova) v3.5.0 and above.\n* This plugin is built for\n\t* iOS FacebookSDK 3.21.1\n\t* Android FacebookSDK 3.21.1\n* GitHub URL : [https://github.com/Wizcorp/phonegap-facebook-plugin/](https://github.com/Wizcorp/phonegap-facebook-plugin/)\n\n## \u003c\u003c --- Cordova Registry Warning [iOS]\n\n****Installing this plugin directly from Cordova Registry results in Xcode using a broken `FacebookSDK.framework`, this is because the current publish procedure to NPM breaks symlinks [CB-6092](https://issues.apache.org/jira/browse/CB-6092). Please install the plugin through a locally cloned copy or re-add the `FacebookSDK.framework` to Xcode after installation.****\n\n## ------------------------------------------ \u003e\u003e\n\n------------------------------------------\n\n## Facebook Requirements and Set-Up\n\nTo use this plugin you will need to make sure you've registered your Facebook app with Facebook and have an `APP_ID` [https://developers.facebook.com/apps](https://developers.facebook.com/apps).\n\n#### Install Guides\n\n- [iOS Guide](platforms/ios/README.md)\n\n- [Android Guide](platforms/android/README.md)\n\n- [Browser Guide](platforms/browser/README.md)\n\n- [PhoneGap Build Guide](platforms/pg-build/README.md)\n\n- [Troubleshooting Guide | F.A.Q.](TROUBLESHOOTING.md)\n\n\n#### Example Apps\n\n`platforms/android` and `platforms/ios` contain example projects and all the native code for the plugin for both Android and iOS platforms. They also include versions of the Android and iOS Facebook SDKs. These are used during automatic installation.\n\n## API\n\n### Login\n\n`facebookConnectPlugin.login(Array strings of permissions, Function success, Function failure)`\n\n**NOTE** : Developers should call `facebookConnectPlugin.browserInit(\u003cappId\u003e)` before login - **Web App ONLY** (see [Web App Guide](platforms/browser/README.md))\n\nSuccess function returns an Object like:\n\n\t{\n\t\tstatus: \"connected\",\n\t\tauthResponse: {\n\t\t\tsession_key: true,\n\t\t\taccessToken: \"\u003clong string\u003e\",\n\t\t\texpiresIn: 5183979,\n\t\t\tsig: \"...\",\n\t\t\tsecret: \"...\",\n\t\t\tuserID: \"634565435\"\n\t\t}\n\t}\n\nFailure function returns an error String.\n\n### Logout\n\n`facebookConnectPlugin.logout(Function success, Function failure)`\n\n### Get Status\n\n`facebookConnectPlugin.getLoginStatus(Function success, Function failure)`\n\nSuccess function returns an Object like:\n\n```\n{\n\tauthResponse: {\n\t\tuserID: \"12345678912345\",\n\t\taccessToken: \"kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn\",\n\t\tsession_Key: true,\n\t\texpiresIn: \"5183738\",\n\t\tsig: \"...\"\n\t},\n\tstatus: \"connected\"\n}\n```\nFor more information see: [Facebook Documentation](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)\n\n### Show a Dialog\n\n`facebookConnectPlugin.showDialog(Object options, Function success, Function failure)`\n\nExample options -\nFeed Dialog:\n\n\t{\n\t\tmethod: \"feed\",\n\t\tlink: \"http://example.com\",\n\t\tcaption: \"Such caption, very feed.\"\n\t}\n\nApp request:\n\n\t{\n\t\tmethod: \"apprequests\",\n\t\tmessage: \"Come on man, check out my application.\"\n\t}\n\nFor options information see: [Facebook feed dialog documentation](https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.0), [Facebook share dialog documentation](https://developers.facebook.com/docs/sharing/reference/share-dialog)\n\nSuccess function returns an Object with `postId` as String or `from` and `to` information when doing `apprequest`.\nFailure function returns an error String.\n\n### The Graph API\n\n`facebookConnectPlugin.api(String requestPath, Array permissions, Function success, Function failure)`\n\nAllows access to the Facebook Graph API. This API allows for additional permission because, unlike login, the Graph API can accept multiple permissions.\n\nExample permissions:\n\n\t[\"public_profile\", \"user_birthday\"]\n\nSuccess function returns an Object.\n\nFailure function returns an error String.\n\n**Note: \"In order to make calls to the Graph API on behalf of a user, the user has to be logged into your app using Facebook login.\"**\n\nFor more information see:\n\n- Calling the Graph API - [https://developers.facebook.com/docs/ios/graph](https://developers.facebook.com/docs/ios/graph)\n- Graph Explorer - [https://developers.facebook.com/tools/explorer](https://developers.facebook.com/tools/explorer)\n- Graph API - [https://developers.facebook.com/docs/graph-api/](https://developers.facebook.com/docs/graph-api/)\n\n# Events\n\nApp events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.\n\n- [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events)\n- [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events)\n- [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success\n\nActivation events are automatically tracked for you in the plugin.\n\nEvents are listed on the [insights page](https://www.facebook.com/insights/)\n\n### Log an Event\n\n`logEvent(String name, Object params, Number valueToSum, Function success, Function failure)`\n\n- **name**, name of the event\n- **params**, extra data to log with the event (is optional)\n- **valueToSum**, a property which is an arbitrary number that can represent any value (e.g., a price or a quantity). When reported, all of the valueToSum properties will be summed together. For example, if 10 people each purchased one item that cost $10 (and passed in valueToSum) then they would be summed to report a number of $100. (is optional)\n\n### Log a Purchase\n\n`logPurchase(Number value, String currency, Function success, Function failure)`\n\n**NOTE:** Both parameters are required. The currency specification is expected to be an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)\n\n## Sample Code\n\n### Login\n\nIn your `onDeviceReady` event add the following\n\n\tvar fbLoginSuccess = function (userData) {\n\t\talert(\"UserInfo: \" + JSON.stringify(userData));\n\t}\n\n\tfacebookConnectPlugin.login([\"public_profile\"],\n        fbLoginSuccess,\n        function (error) { alert(\"\" + error) }\n    );\n\n### Get Access Token\n\nIf you need the Facebook access token (for example, for validating the login on server side), do:\n\n\tvar fbLoginSuccess = function (userData) {\n\t\talert(\"UserInfo: \" + JSON.stringify(userData));\n\t\tfacebookConnectPlugin.getAccessToken(function(token) {\n\t\t\talert(\"Token: \" + token);\n\t\t}, function(err) {\n\t\t\talert(\"Could not get access token: \" + err);\n\t\t});\n\t}\n\n\tfacebookConnectPlugin.login([\"public_profile\"],\n        fbLoginSuccess,\n        function (error) { alert(\"\" + error) }\n    );\n\n### Get Status and Post-to-wall\n\nFor a more instructive example change the above `fbLoginSuccess` to;\n\n\tvar fbLoginSuccess = function (userData) {\n\t\talert(\"UserInfo: \" + JSON.stringify(userData));\n    \tfacebookConnectPlugin.getLoginStatus(\n    \t\tfunction (status) {\n    \t\t\talert(\"current status: \" + JSON.stringify(status));\n\n    \t\t\tvar options = { method:\"feed\" };\n    \t\t\tfacebookConnectPlugin.showDialog(options,\n    \t\t\t\tfunction (result) {\n        \t\t\t\talert(\"Posted. \" + JSON.stringify(result));\t\t\t\t},\n        \t\tfunction (e) {\n    \t\t\t\talert(\"Failed: \" + e);\n    \t\t\t});\n    \t\t}\n    \t);\n    };\n\n### Getting a User's Birthday\n\nUsing the graph api this is a very simple task:\n\n\tfacebookConnectPlugin.api(\"\u003cuser-id\u003e/?fields=id,email\", [\"user_birthday\"],\n\t\tfunction (result) {\n\t\t\talert(\"Result: \" + JSON.stringify(result));\n\t\t\t/* alerts:\n\t\t\t\t{\n\t\t\t\t\t\"id\": \"000000123456789\",\n\t\t\t\t\t\"email\": \"myemail@example.com\"\n\t\t\t\t}\n\t\t\t*/\n\t\t},\n\t\tfunction (error) {\n\t\t\talert(\"Failed: \" + error);\n\t\t});\n\n### Publish a Photo\n\nSend a photo to a user's feed\n\n```\nfacebookConnectPlugin.showDialog( \n    {\n        method: \"feed\",\n        picture:'https://www.google.co.jp/logos/doodles/2014/doodle-4-google-2014-japan-winner-5109465267306496.2-hp.png',\n        name:'Test Post',\n        message:'First photo post',    \n        caption: 'Testing using phonegap plugin',\n        description: 'Posting photo using phonegap facebook plugin'\n    }, \n    function (response) { alert(JSON.stringify(response)) },\n    function (response) { alert(JSON.stringify(response)) });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWizcorp%2Fphonegap-facebook-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWizcorp%2Fphonegap-facebook-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWizcorp%2Fphonegap-facebook-plugin/lists"}