npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-social-auth

v2.0.0

Published

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

Downloads

29

Readme

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

  • 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!

Copyright and license

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