Skip to content

Instantly share code, notes, and snippets.

@Mattchewone Mattchewone/App.js Secret
Last active Jan 11, 2019

Embed
What would you like to do?
basic react app
import React, { Component } from 'react'
import { StyleSheet, Text, View, Button } from 'react-native'
import { authorize } from 'react-native-app-auth'
const config = {
issuer: 'https://accounts.google.com',
clientId: 'SECRET',
redirectUrl: 'REDIRECT_URL',
scopes: ['openid', 'profile']
}
export default class App extends Component {
async _authorize () {
try {
// Make request to Google to get token
const authState = await authorize(config)
console.log({ authState })
} catch (error) {
console.log('error', error)
}
}
render () {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Button style={styles.login} onPress={this._authorize} title='Login' />
</View>
)
}
}
const styles = StyleSheet.create({ ... })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.