kandi background
Explore Kits

react-native-fblogin | React Native 'Facebook Login' component without wrapping | Authentication library

 by   fadidevv JavaScript Version: Current License: MIT

 by   fadidevv JavaScript Version: Current License: MIT

Download this library from

kandi X-RAY | react-native-fblogin Summary

react-native-fblogin is a JavaScript library typically used in Security, Authentication, React Native applications. react-native-fblogin has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can install using 'npm i @fadidev/react-native-fblogin' or download it from GitHub, npm.
📦 A React Native 'Facebook Login' component without wrapping any Facebook Native/Web SDK
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • react-native-fblogin has a low active ecosystem.
  • It has 19 star(s) with 3 fork(s). There are 3 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 0 open issues and 3 have been closed. On average issues are closed in 21 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of react-native-fblogin is current.
react-native-fblogin Support
Best in #Authentication
Average in #Authentication
react-native-fblogin Support
Best in #Authentication
Average in #Authentication

quality kandi Quality

  • react-native-fblogin has 0 bugs and 0 code smells.
react-native-fblogin Quality
Best in #Authentication
Average in #Authentication
react-native-fblogin Quality
Best in #Authentication
Average in #Authentication

securitySecurity

  • react-native-fblogin has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • react-native-fblogin code analysis shows 0 unresolved vulnerabilities.
  • There are 1 security hotspots that need review.
react-native-fblogin Security
Best in #Authentication
Average in #Authentication
react-native-fblogin Security
Best in #Authentication
Average in #Authentication

license License

  • react-native-fblogin is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
react-native-fblogin License
Best in #Authentication
Average in #Authentication
react-native-fblogin License
Best in #Authentication
Average in #Authentication

buildReuse

  • react-native-fblogin releases are not available. You will need to build from source code and install.
  • Deployable package is available in npm.
  • Installation instructions, examples and code snippets are available.
  • It has 74 lines of code, 3 functions and 8 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
react-native-fblogin Reuse
Best in #Authentication
Average in #Authentication
react-native-fblogin Reuse
Best in #Authentication
Average in #Authentication
Top functions reviewed by kandi - BETA

Coming Soon for all Libraries!

Currently covering the most popular Java, JavaScript and Python libraries. See a SAMPLE HERE.
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.

react-native-fblogin Key Features

📦 A React Native 'Facebook Login' component without wrapping any Facebook Native/Web SDK

Installation

copy iconCopydownload iconDownload
yarn add @fadidev/react-native-fblogin

loginInWithPermissions()

copy iconCopydownload iconDownload
import React, { Component } from 'react'
import { View, Button } from 'react-native'
import { loginInWithPermissions } from '@fadidev/react-native-fblogin'

export default class App extends Component {
  state = {
    login: false
  }
  
  /*
     runNow: default is TRUE you can skip this prop, (optional)
     redirectUrl: default is https://facebook.com/connect/login_success.html, 
                  you can skip or replace with your URL, (optional)
     getMyInformationsFields: default is id,first_name,last_name,name,email,picture 
                  you can skip it or add more, (optional)
     clientId: default is null and its required
     secretKey: default is null and its required
     onLoginSuccess: default returns console.log({...data}) when login success
     onLoginFailure: default returns console.log({...error}) when something fails
  */
  
  loginIn = () => {
    const { login } = this.state
    if (login) {
      return loginInWithPermissions({
        runNow: true,
        redirectUrl: 'https://facebook.com/connect/login_success.html',
        getMyInformationsFields: ['id,first_name,last_name,name,email,picture'],
        clientId: 'REPLACE_WITH_YOUR_APP_ID',
        secretKey: 'REPLACE_WITH_YOUR_SECRET_KEY',
        onLoginSuccess: data => console.log(data),
        onLoginFailure: error => console.log(error)
      })
    }
  }
  
  render() {
    const { loginIn } = this
    return (
      <View style={{
        flex: 1, 
        justifyContent: 'space-evenly', 
        width: '50%', 
        alignSelf: 'center', 
        marginVertical: '10%'}}>
      <Button onPress={() => this.setState({ login: true })} title='Login'/>
        {loginIn()} // mounting the component when button clicked
      </View>
    )
  }
}

Response:

copy iconCopydownload iconDownload
{
   access_token: string,
   email: string,
   expires_in: integer,
   first_name: string,
   id: string,
   isLoggedIn: boolean,
   last_name: string,
   name: string,
   picture: {
        data: {
            height: integer,
            is_silhouette: boolean,
            url: string,
            width: integer
        }
   },
   token_type: string
}

⚡ getUsername()

copy iconCopydownload iconDownload
import React, { Component } from 'react'
import { View, Button } from 'react-native'
import { getUsername } from '@fadidev/react-native-fblogin'

export default class App extends Component {

  render() {
    return (
      <View style={{
        flex: 1, 
        justifyContent: 'space-evenly', 
        width: '50%', 
        alignSelf: 'center', 
        marginVertical: '10%'}}>
      <Button
          onPress={() => {
            getUsername()
              .then(username => console.log(username))
              .catch(error => console.log(error))
          }}
          title='getUsername'
        />
      </View>
    )
  }
}

Response:

copy iconCopydownload iconDownload
{ 
   username: string
}

getAccessToken()

copy iconCopydownload iconDownload
import React, { Component } from 'react'
import { View, Button } from 'react-native'
import { getAccessToken } from '@fadidev/react-native-fblogin'

export default class App extends Component {

  render() {
    return (
      <View style={{
        flex: 1, 
        justifyContent: 'space-evenly', 
        width: '50%', 
        alignSelf: 'center', 
        marginVertical: '10%'}}>
      <Button onPress={() => alert(JSON.stringify(getAccessToken()))} title='getAccessToken'/>
      </View>
    )
  }
}

Response:

copy iconCopydownload iconDownload
{ accessToken: string, expiresIn: string, status: boolean }

getMyInformations()

copy iconCopydownload iconDownload
import React, { Component } from 'react'
import { View, Button } from 'react-native'
import { getMyInformations } from '@fadidev/react-native-fblogin'

export default class App extends Component {

  render() {
    return (
      <View style={{
        flex: 1, 
        justifyContent: 'space-evenly', 
        width: '50%', 
        alignSelf: 'center', 
        marginVertical: '10%'}}>
      <Button onPress={() => alert(JSON.stringify(getMyInformations()))} title='getMyInformations'/>
      </View>
    )
  }
}

Response:

copy iconCopydownload iconDownload
{ 
   id: double, 
   first_name: string, 
   last_name: string, 
   name: string, 
   email: string, 
   picture: object, 
   token_type: string 
}

logout()

copy iconCopydownload iconDownload
import React, { Component } from 'react'
import { View, Button } from 'react-native'
import { logout } from '@fadidev/react-native-fblogin'

export default class App extends Component {

  render() {
    return (
      <View style={{
        flex: 1, 
        justifyContent: 'space-evenly', 
        width: '50%', 
        alignSelf: 'center', 
        marginVertical: '10%'}}>
      <Button onPress={() => alert(JSON.stringify(logout()))} title='logout'/>
      </View>
    )
  }
}

Response:

copy iconCopydownload iconDownload
{ message: string, status: boolean }

Community Discussions

Trending Discussions on Authentication
  • Google API: java.lang.ClassNotFoundException: Didn't find class "sun.misc.Service"
  • How to Handle 26-Byte Secret for Time-based One Time Password?
  • Google Colab - Google Drive can´t be mounted anymore - Browser Popup (Google Drive for Desktop) instead of Link in the code output for authorization
  • How to Ensure only one account can sign into flutter app from one phone
  • kubectl versions Error: exec plugin is configured to use API version client.authentication.k8s.io/v1alpha1
  • SNMPv3 Get Request authorization problem for SNMP4J although working via net-snmp
  • Unauthorized (Invalid Token) when authenticating with JWT Bearer Token after update to .NET 6
  • Signing into slack-desktop not working on 4.23.0 64-bit (Ubuntu)
  • How to manage Google Cloud credentials for local development
  • Blazor Server side, ExternalRegister buttons at .razor page
Trending Discussions on Authentication

QUESTION

Google API: java.lang.ClassNotFoundException: Didn't find class "sun.misc.Service"

Asked 2022-Apr-08 at 12:20

I've imported all necessary google dependencies for authenticate the user:

def play_services_version = "15.0.1"
implementation 'com.google.api-client:google-api-client:1.33.0'
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.32.1'
implementation 'com.google.apis:google-api-services-drive:v3-rev20211107-1.32.1'
implementation 'com.sun.net.httpserver:http:20070405'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation "com.google.android.gms:play-services-auth:$play_services_version"
implementation "com.google.android.gms:play-services-drive:$play_services_version"
implementation 'com.squareup.okio:okio:1.14.0'

Receiving the user credetials.

/**
 * Creates an authorized Credential object.
 * @param HTTP_TRANSPORT The network HTTP Transport.
 * @return An authorized Credential object.
 * @throws IOException If the credentials.json file cannot be found.
 */
private static Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws IOException {
    // Load client secrets.
    InputStream in = DriveQuickstart.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
    if (in == null) {
        throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
    }
    GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));


    //Token Folder
    java.io.File s = new File(TOKENS_DIRECTORY_PATH);
    if(!s.exists()){
        boolean mkdir = s.mkdir();
    }
    File tokenFolder = new File(con.getFilesDir() +
            File.separator + TOKENS_DIRECTORY_PATH);
    if (!tokenFolder.exists()) {
        tokenFolder.mkdirs();
    }

    // Build flow and trigger user authorization request.
    GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
            HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
            .setDataStoreFactory(new FileDataStoreFactory(tokenFolder))
            .setAccessType("offline")
            .build();

    LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();

    Credential credential = new AuthorizationCodeInstalledApp(flow,receiver ).authorize("user");
    //returns an authorized Credential object.
    return credential;
}

Since that Is official google documentation, the code should be on newest version, however executing the code, I receive Failed resolution of: Lsun/misc/Service Caused by: java.lang.ClassNotFoundException: Didn't find class "sun.misc.Service" error.

Is this due to missing dependencies or is that a bug from google?

ANSWER

Answered 2022-Apr-08 at 12:20

The first sentence of the documentation that you linked to is: "Complete the steps described in the rest of this page to create a simple Java command-line application that makes requests to the Drive API." (emphasis added) Those instructions are not for Android.

Source https://stackoverflow.com/questions/71788616

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install react-native-fblogin

You will need to create Facebook Login App to use with this component and +add Click to see Link in your redirect-url Facebook Login App Settings in Valid OAuth Redirect URIs input field, this link is required in Facebook Login App as it will get use when redirection will occurs when user will logged-in from your application, also you can control this redirect-url from this component as a prop redirectUrl='YOUR_REDIRECT_URL' for server-side scriptings like PHP, JSP, nodeJS to store user information like token,first_name,last_name when user will logged-in but it's optional. If you have created already Facebook Login App then you can skip all steps except adding redirect-url in your Facebook Login App Settings in Valid OAuth Redirect URIs input field. When everything is done you just need to grab clientId and secretKey from your Facebook Login App, this component will need these props later. Note: When you create new Facebook Login App by default App mode always set to development and this component works fine with it, but when you are ready to upload your React Native app to the appstores do not forget to submit your Facebook Login App for reviewing to change it's status from development to public mode.
install the react-native-fblogin package in your project or clone Example project:.

Support

Just submit a pull request!.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Reuse Pre-built Kits with react-native-fblogin
Consider Popular Authentication Libraries
Compare Authentication Libraries with Highest Support
Compare Authentication Libraries with Highest Quality
Compare Authentication Libraries with Highest Security
Compare Authentication Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.