Examples for using Eauth
yarn
yarn start
Use Case | Using URL | Frontend | Backend |
---|---|---|---|
using node-eauth-server for OAuth | http://localhost:59011/ | src/index.html#L49 | server.js#L18 |
using Eauth SDK (express) | http://localhost:59011/ | src/index.html#L60 | server.js#L90 |
using node-eauth-server as auth server through proxy | http://localhost/ | src/index.html#L76 | Checkout Setup |
-
For Eauth
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/pelith/eauth.js/dist/eauth.min.js"></script>
-
For Fortmatic
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/fortmatic@latest/dist/fortmatic.js"></script>
For local node-eauth-server
- follow the installation
- add a new record
id=1, name=NULL, client_id='eauth', client_secret='SEEEECRET', redirect_uri='http://localhost:59011/oauth_success', grant_types=NULL, scope=NULL, user_id=NULL
tooauth_clients
table which migrated by config.json - to prevent the session conflicts in localhost, add
127.0.0.1 eauth.local
in /etc/hosts
For historical reasons, cookies contain a number of security and privacy infelicities. For example, a server can indicate that a given cookie is intended for “secure” connections, but the Secure attribute does not provide integrity in the presence of an active network attacker. Similarly, cookies for a given host are shared across all the ports on that host, even though the usual “same-origin policy” used by web browsers isolates content retrieved via different ports.
Setup proxy for Eauth server using local node-eauth-server
-
You can use the config below for
/etc/nginx/sites-available/default
server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { proxy_pass http://localhost:59011/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache_bypass $http_upgrade; try_files $uri $uri/ =404; } location /eauth/ { proxy_pass http://localhost:8080/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache_bypass $http_upgrade; } }
-
sudo systemctl reload nginx
Here's the default nginx configuration file if you need it 😏