Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to use graph api with react native

<LoginButton
    onLoginFinished={
      (error, result) => {
        if (error) {
          alert("login has error: " + result.error);
        } else if (result.isCancelled) {
          alert("login is cancelled.");
        } else {

          AccessToken.getCurrentAccessToken().then(
            (data) => {
              let accessToken = data.accessToken
              alert(accessToken.toString())

              const responseInfoCallback = (error, result) => {
                if (error) {
                  console.log(error)
                  alert('Error fetching data: ' + error.toString());
                } else {
                  console.log(result)
                  alert('Success fetching data: ' + result.toString());
                }
              }

              const infoRequest = new GraphRequest(
                '/me',
                {
                  accessToken: accessToken,
                  parameters: {
                    fields: {
                      string: 'email,name,first_name,middle_name,last_name'
                    }
                  }
                },
                responseInfoCallback
              );

              // Start the graph request.
              new GraphRequestManager().addRequest(infoRequest).start()

            }
          )

        }
      }
    }
    onLogoutFinished={() => alert("logout.")}/>
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery check screen width 
Javascript :: Automatic update javascript fileversion 
Javascript :: Return object in parenthesis to avoid it being considered a wrapping function body 
Javascript :: js template literal avoid white spaces 
Javascript :: Creatable Multiselect 
Javascript :: Backbone Sync And Fetch Example 
Javascript :: javascript destructure multiple levels 
Javascript :: ajaxpost 
Javascript :: Can Execute Backbone In RequireJS 
Javascript :: how to read json data from database in laravel 
Javascript :: convert js to tsx 
Javascript :: hoe to find items in mongoose 
Javascript :: get a nodes path alias 
Javascript :: upload file to s3 using pre signed url javascript 
Javascript :: regex remove whitespace 
Javascript :: how can i debug compressed javascript in chrome 
Javascript :: javascript class is not defined 
Javascript :: Search an elemnt in a sorted and rotated array 
Javascript :: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile 
Javascript :: regex for erlang online 
Javascript :: javascript to typescript converter 
Javascript :: xss bypass greater than 
Javascript :: load content on user language in javascript 
Javascript :: javascript dom functions 
Javascript :: Plumsail - DataTable Cascading Dropdowns 
Javascript :: javascript reduce form object 
Javascript :: javascript Change color based on a keys value in each object of array 
Javascript :: Call Injected AngularJs Service In Controller From Blazor Within CustomElement/WebComponent 
Javascript :: angularjs getting Error: [$rootScope:inprog] $digest already in progress when changed from Fetch to $http + $q 
Javascript :: Filtering smart-table on transformed data 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =