authservestatic
Version:
Serve static files with google authentication
47 lines (40 loc) • 1.12 kB
Markdown
Simple module to serve static files with authentication.
This is the config file that will be used to load the keys for auth, redirection urls and other data.
You need to have a file called `staticauth.json` in the root.
It will look something like this:
```json
{
"domain": "https://yourdomain.com",
"callbackEndpoint": "/auth/google/callback",
"contentFolder": "site",
"googleAuth": {
"clientID": "32724...90634r.apps.googleusercontent.com",
"clientSecret": "QLYmt...YxGHq",
"userProfileURL": "https://www.googleapis.com/oauth2/v3/userinfo"
},
"scope": [
"profile",
"email"
],
"cookie": {
"name": "session",
"keys": [
"key 1",
"key 2"
],
"maxAge": 86400000 // age in seconds
},
"validDomains": [
"yourcompany.com"
],
"failureMessage": "You need a valid YOURCOMPANY account to login",
"failedAuthPage": "./failedauth.html",
"successRedirect": "/docs"
}
```
- make sure you dump your static content into the site folder
- Install deps using `npm install`
- do `npm run deploy`