-
-
Save Mattchewone/31dea6f34633bc086865ccb0876cf378 to your computer and use it in GitHub Desktop.
basic react app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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