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.js
in thegithub_oauth_options
object - In this file, change
token_secret
for 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 install
to download dependencies - Once install is completed execute
npm run setup:init
This 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/tls
directory:hz create-cert && mv *.pem config/tls
(this command will create two files,horizon-cert.pem
andhorizon-key.pem
which you can find inconfig/tls
)
- Start RethinkDB:
- Execute
npm start
to 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