react-horizon
react-horizon copied to clipboard
An example application that shows how to integrate React, React Router, and Horizon.io with OAuth authentication
react-horizon
This application shows how to integrate React, React Router, and Horizon.io with OAuth authentication. You can follow the tutorial to build this application or jump straight to the code.
Requirements
Pre-Install
- Register a new application on Github:
- Go to https://github.com/settings/applications/new and enter the following information:
- Application name: react_horizon (any name will do)
- Homepage URL: https://localhost:8181 (or whatever your URL is, just remember the https part)
- When you register the application, the client ID, and client secret will be presented
- Copy this values to the
config/index.jsin thegithub_oauth_optionsobject - In this file, change
token_secretfor something else. This is the key used to sign the authentication tokens. You can change the project name and the port if you want
Installation
- Inside the cloned repository execute
npm installto download dependencies - Once install is completed execute
npm run setup:initThis will:- Start RethinkDB:
rethinkdb - Import the schema and permission rules to RethinkDB server:
hz schema apply -n react_horizon -c localhost:28015 ./config/rethinkdb/schema.toml(change the name of the project if you changed in the previous step and the connection URL if it is different for you) - Create the self-signed certificate (
hz create-cert) for SSL and move them to theconfig/tlsdirectory:hz create-cert && mv *.pem config/tls(this command will create two files,horizon-cert.pemandhorizon-key.pemwhich you can find inconfig/tls)
- Start RethinkDB:
- Execute
npm startto bundle the application and start the Node.js server - Go to https://localhost:8181 (or whatever your URL is), log in with your Github account and start playing with the app.
License
MIT