Connect to OAuth2 application with React & Firebase
via npm:
npm install --save react-firebase-connect
via yarn:
yarn add react-firebase-connect
import React, { Component } from 'react'
import { GithubLogin, initializeApp } from 'react-firebase-connect'
import 'react-firebase-connect/dist/index.css'
// Your firebase tokens
initializeApp({{
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
}})
class App extends Component {
render() {
return (
<GithubLogin
onSuccess={(result) => {
console.log('success:', result)
}}
onFailure={(error) => {
console.log('error:', error)
}}
scopes="repos"
theme="dark"
/>
)
}
}
onSuccess: function, Called when the connect succeed
onFailure: function, Called when the connect failed
theme: string, depends on the component it's in, default is "default"
scopes: string, see Github API documentation
scopes: string, see Github API documentation
MIT © nowlow