tableflip/react-native-meteor-oauth

Name: react-native-meteor-oauth

Owner: TABLEFLIP

Description: Oauth2 login to a Meteor server in React Native

Created: 2016-10-21 15:46:18.0

Updated: 2018-01-11 18:30:55.0

Pushed: 2016-10-24 08:40:00.0

Homepage: null

Size: 17

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

react-native-meteor-oauth

Oauth2 login to a Meteor server in React Native

How?
rt React, { Component } from 'react'
rt View from 'react-native'
rt Meteor from 'react-native-meteor'
rt Login from 'react-native-meteor-oauth'

t meteorHost = '192.168.1.73:3000' // Put your local IP here if running in dev
or.connect(`ws://${meteorHost}/websocket`)

rt default () => {
turn (<View>
<Login
  provider='Github'
  callbackUrl='http://localhost:3000/_oauth/github'
  meteorServerDomain={meteorHost}
  meteorServerProtocol='http'
  clientId='YOUR_GITHUB_CLIENT_ID'
/>
View>)

This module depends on react-native-meteor under the hood, which should then be used for subscriptions, method calling and so on once login has occurred.

The react-native-meteor docs specify that you should Meteor.connect only once in your app's parent component. The example above is reductive, but in a more realistic app this would involve having the Meteor.connect line in the parent component and requiring/using react-native-meter-oauth in subcomponents.

Which providers are supported?

Currently: Github, Google and Facebook.

Any other provider which allow login with Oauth2 can easily be added, which unfortunately does not presently include Twitter.

Props

ttonContainer: { flexDirection: 'row', justifyContent: 'space-around' },
tton: { flex: -1 },
ttonLogin: { backgroundColor: '#bbb'},
ttonLogout: { backgroundColor: '#bbb'},
ttonLoginText: { textAlign: 'center', paddingVertical: 12, paddingHorizontal: 40 },
ttonLogoutText: { textAlign: 'center', paddingVertical: 12, paddingHorizontal: 40 },
xt: { textAlign: 'center', marginBottom: 15 },
ew: { flex: 1, alignSelf: 'stretch', justifyContent: 'center' }

Provider-specific styles are also merged into these for the Github, Google and Facebook.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.