node-eth-auth-server v1.1.1
ETH Auth Server
An OAuth-compatiable service based on Ethereum credentials to authenticate users on a website.
Installing
After installing dependencies,
Move
config/config.json.example
toconfig/config.json
:cp config/config.json.example config/config.json ln -s ../../../config/config.json components/oauth/config/config.json
Configure your
config/config.json
accordingly. Edit the following entries:{ "development": { // app secret "secret": "YOUR_SECRET_HERE", // your brand name "banner": "YOUR_BANNER_HERE", // use the connection path from this environment variable, if specified "use_env_variable": "CONNECTION_PATH", /* or fill in database-related configs... */ }, "test": { /* ... */ } "production": { /* ... */ } }
Note that you may need to install additional packages to operate on databases.
Usage
Server
Start the server: node index.js
. \
Test it on http://localhost:8080/
.
Docker
docker build -t pelith/node-eth-auth-server .
docker run --net=host -d pelith/node-eth-auth-server
Testing
Users should have the MetaMask extension or alternatives installed in order to use the service. For further information, click the MetaMask badge below.
In the demo page
/
is an ordinary login button. Think it as a way to sign in with Ethereum credentials. (You need to unlock your wallet on MetaMask prior to this step).In MetaMask, you can check the banner, usually the brand name of a site, and a challenge string. If that is indeed the site you are about to login, click "Sign" to proceed.
- Next, in the second page, where your wallet address is shown and you are asked for authorization. Think this step as a process to bind that wallet address to your account. Click "Authorise" to proceed, or click "Use another account" to switch between different wallets.
- You will be redirected back to the original site. Click "Logout" will log you out and reset the session.
5 years ago