/** * Sample React Native App * https://github.com/facebook/react-native */ import React, {Component} from 'react'; import RNHumanAPI from 'react-native-human-api'; import {StyleSheet, Text, View, TouchableOpacity} from 'react-native'; class App extends Component { sendAuth = (data) => { // send for auth_url with additional info console.log('auth'); console.log(data); // data.client_id // data.human_id // data.session_token }; connectHumanAPI = () => { const humanAPI = new RNHumanAPI(); const options = { client_id: 'b2fd0a46e2c6244414ef4133df6672edaec378a1', client_user_id: 'user@email.com', //public_token: 'xxxxxxxxxxxxxxxxxxxxxxx', // custom auth handle without auth_url auth: (data) => this.sendAuth(data), //auth_url: 'AUTH_URL', auth_url: 'https://us-central1-health-score-6740b.cloudfunctions.net/humanAPITokenExchange', success: (data) => console.log(`Human API Success Callback: ${data}`), // callback when success with auth_url cancel: () => console.log('cancel'), // callback when cancel }; humanAPI.onConnect(options); }; render() { return ( Welcome to React Native! To get started, edit index.android.js Shake or press menu button for dev menu Connect HumanAPI ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#fff', marginBottom: 5, }, button: { padding: 5, borderRadius: 5, backgroundColor: '#337ab7', }, }); export default App;