adamjmcgrath / react-native-simple-auth

OAuth login for React Native
MIT License
669 stars 104 forks source link
oauth react-native

react-native-simple-auth Build Status

OAuth login for React Native

Screencast

iOS Android
Screencast Screencast

Source of example app: https://github.com/adamjmcgrath/ReactNativeSimpleAuthExample

Install

Providers Setup

Google

Facebook

Twitter

Tumblr

Untappd

Usage

Create a configuration object for each of the providers you want to authorize with (required keys are in parenthesis):

See secrets.example.js.

import { google, facebook, twitter, tumblr } from 'react-native-simple-auth';

google({
  appId: '123-123abc.apps.googleusercontent.com',
  callback: 'com.reactnativesimpleauthexample:/oauth2redirect',
}).then((info) => {
  // info.user - user details from the provider
  // info.credentials - tokens from the provider
}).catch((error) => {
  // error.code
  // error.description
});

License

react-native-simple-auth is released under the MIT license.