Presentation is loading. Please wait.

Presentation is loading. Please wait.

BUILDING A FACEBOOK APP. STEP 1 Create a Developers License. Make sure to take note/record the app id/key.

Similar presentations


Presentation on theme: "BUILDING A FACEBOOK APP. STEP 1 Create a Developers License. Make sure to take note/record the app id/key."— Presentation transcript:

1 BUILDING A FACEBOOK APP

2 STEP 1 Create a Developers License. Make sure to take note/record the app id/key

3 STEP 2. Understand the methodology GRAPH API explorer. – PERMISSIONS – ACCESS TOKENS (OAUTH).

4 Access tokens and OAuth An access token is a random string that provides temporary, secure access to Facebook APIs. A token identifies a User, App or Page session and provides information about granted permissions. They also include information about when the token will expire and which app generated the token. Because of privacy checks, the majority of API calls on Facebook need to be signed with an access token. All access tokens are generated with OAuth 2.0 authentication and authorization procedures.UserAppPagegranted permissionswhen the token will expireOAuth 2.0

5 Example of oauth

6 WHAT IS JSON? Stands for JavaScript Object Notation, and is a text-based open standard designed for human-readable data interchange.open standard human-readable It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects.JavaScriptdata structuresassociative arrays

7 JSON is built on two structures: – A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. – An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence. These are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangeable with programming languages also be based on these structures. – An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by, (comma). – A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.

8 In other words … It is a very complex object! It represents and stores data. Most APIs will allow you to choose to receive the ‘response data’ in JSON format. This makes it easier for us to manipulate and ‘read’.

9 STEP 3. Implement SDK for Javascript. What is an SDK? SDK (Software Development Kit) A Software Development Kit is a package of pre- written code that developers can re-use in order to minimize the amount of unique code that they need to develop themselves. SDKs can help to prevent unnecessary duplication of effort in a development community.

10 SDK and APIs So what is the difference between an API and an SDK? an API is an interface. It's like the specification of the telephone system or the electrical wiring in your house. Anything* can use it as long as it knows how to interface. You can even buy off-the-shelf software to use a particular API, just as you can buy off the shelf telephone equipment or devices that plug into the AC wiring in your house. an SDK is implementation tooling. It's like a kit that allows** you to build something custom to hook up to the telephone system or electrical wiring.

11 FACEBOOK SDK CORE METHODS Core Methods FB.init FB.api FB.ui

12 FB.init Init Using the method outlined on facebook dev site, the JS SDK is loaded asynchronously so it does not block loading other elements of your page. The function assigned to window.fbAsyncInit is run as soon as the SDK source has finished loaded. Any code that you want to run after the SDK is loaded should be placed within this function and after the call to FB.init. For example, this is where you would test the logged in status of the user or subscribe to any Facebook events in which your application is interested.test the logged in statussubscribe to any Facebook events See the FB.init documentation for a full list of available initialization options.FB.init documentation By default, for performance, the JS SDK is loaded minified. If you are in development and want an un-minified version of the JS SDK, which also enforce arguments in a stricter way, then turn on the debug argument.minified

13 FB.api Overview FB.api makes API calls to the Graph API or Deprecated REST API.Graph APIDeprecated REST API Examples FB.api ( ‘query url’, callback function); FB.api('/me', function(response) { alert(response.name); }); – Get the 3 most recent Post Objects Connected to (in other words, authored by) the Facebook Platform Page Object:

14 FB.ui Overview FB.ui is a generic helper method for triggering Dialogs which allow the user to take some action. Dialogs

15 Facebook SDK methods LOGIN/LOGOUT FB.login() — ask the user to login or request additional permissions FB.login() FB.logout() — log the user out (only if the user has authorized your application) FB.logout() FB.getLoginStatus() — asynchronous method to get the current Facebook login status of the user FB.getLoginStatus() FB.getAuthResponse() — synchronous accessor for the current authorization response record FB.getAuthResponse() FB.login() — ask the user to login or request additional permissions FB.login() FB.logout() — log the user out (only if the user has authorized your application) FB.logout() FB.getLoginStatus() — asynchronous method to get the current Facebook login status of the user FB.getLoginStatus() FB.getAuthResponse() — synchronous accessor for the current authorization response record FB.getAuthResponse()


Download ppt "BUILDING A FACEBOOK APP. STEP 1 Create a Developers License. Make sure to take note/record the app id/key."

Similar presentations


Ads by Google