Socket
Socket
Sign inDemoInstall

react-native-social-auth

Package Overview
Dependencies
0
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-social-auth

React Native module provides auth methods via social networks using native APIs


Version published
Weekly downloads
13
increased by8.33%
Maintainers
1
Install size
31.5 MB
Created
Weekly downloads
 

Readme

Source

React Native Social Auth

React Native module provides auth methods via social networks using native APIs.

Very important! The module doesn't provide full stack communication with social networks API, it made just for auth.

preview

Table of contents

  • Dependencies
  • What using
  • Example
  • Installation
  • Usage
  • Contributing
  • Copyright and license

Dependencies

  • React Native >= 0.40.0 (use 0.5 branch that works with previous versions of RN)

What using

  • facebook
    • FacebookSDK
  • twitter
    • Accounts.framework and reverse auth (iOS)

Example

here

Installation

Common

  1. Install package via npm:
  npm install react-native-social-auth
  1. Inside your code include JS part by adding
import SocialAuth from 'react-native-social-auth';

Perform platform specific setup - iOS - Android

Usage

Facebook

Constants
  • SocialAuth.facebookPermissionsType.read
  • SocialAuth.facebookPermissionsType.write
setFacebookApp({id, name})

SocialAuth.setFacebookApp({id: 'APP_ID', name: 'DISPLAY_NAME'});
getFacebookCredentials(permissions, permissionsType)
returns a promise
  • resolved with credentials (object contains accessToken, userId, hasWritePermissions)
  • rejected with error (object contains code and message)

SocialAuth.getFacebookCredentials(["email", "user_friends"], SocialAuth.facebookPermissionsType.read)
.then((credentials) => console.log(credentials));
.catch((error) => console.log(error))

Twitter

getTwitterSystemAccounts()
returns a promise
  • resolved with accounts (array of objects like {username: "userName"})
  • rejected with error (object contains code and message)
SocialAuth.getTwitterSystemAccounts()
.then((accounts) => console.log(accounts))
.catch((error) => console.log(error));
getTwitterCredentials(username, [reverseAuthResponse])
  • username (Twitter account user name without @)

  • reverseAuthResponse (is a string that returns by twitter's api when we do the first part of reverse auth)

    #define twitterAppConsumerKey @"..."
    #define twitterAppConsumerSecret @"..."
    
    But this way is not SAFE!
    • other option is that your server can perform the first part of reverse auth and send you back response of it. It looks like this
      OAuth oauth_timestamp="...", oauth_signature="...", oauth_consumer_key="...", oauth_nonce="...", oauth_token="...", oauth_signature_method="HMAC-SHA1", oauth_version="1.0"
      
      Then you just pass it to the function as a second parameter
returns a promise
  • resolved with credentials (object contains oauthToken, oauthTokenSecret, userName)
  • rejected with error (object contains code and message)
SocialAuth.getTwitterCredentials("dimkol")
.then((credentials) => console.log(credentials))
.catch((error) => console.log(error));

Contributing

Just submit a pull request!

Code and documentation copyright 2015 Dmitriy Kolesnikov. Code released under the MIT license.

Keywords

FAQs

Last updated on 02 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc