Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsamaya/aws-lambda-node-authorizer-auth0
AWS λ Authorizer Example with Auth0
https://github.com/tsamaya/aws-lambda-node-authorizer-auth0
auth0 authorizer aws aws-lambda
Last synced: 23 days ago
JSON representation
AWS λ Authorizer Example with Auth0
- Host: GitHub
- URL: https://github.com/tsamaya/aws-lambda-node-authorizer-auth0
- Owner: tsamaya
- License: mit
- Created: 2021-04-29T09:00:53.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-10T22:32:12.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T07:39:23.442Z (3 months ago)
- Topics: auth0, authorizer, aws, aws-lambda
- Language: JavaScript
- Homepage: https://roasted-thread.surge.sh/
- Size: 2.18 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aws-lambda-node-authorizer-auth0
[AWS API Gateway](https://aws.amazon.com/api-gateway/) Custom authorizer function with [Auth0](https://auth0.com/) example in [NodeJS](https://nodejs.org/en/)
### 🌍 Live demo
Here is the live demo: [roasted-thread.surge.sh](https://roasted-thread.surge.sh/)
### 🔨Build and Deploy
- Setup an [auth0 application](https://auth0.com/docs/applications).
```bash
cd /path/to/repo/
```#### 💻 Backend
```bash
cd backendexport AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=npm install
```- Get your `Domain` (under `applications->${YOUR_APP_NAME}->settings`) and plugin your `AUTH0_DOMAIN` in a new file called `secrets.json` (based on `secrets.example.json`).
- Get your `Certificate` (under `applications->${YOUR_APP_NAME}->settings->Show Advanced Settings->Certificates->DOWNLOAD CERTIFICATE`). Download it as `PEM` format and save it as a new file called `key.pem`
- Deploy the service with `npx serverless deploy` and grab the public and private endpoints.
#### 🖥 Frontend
```bash
cd frontendnpm install
```- Get your `Client ID` (under `applications->${YOUR_APP_NAME}->settings`)
- Create files `.env.production` and `.env.development` with values fron auth0 and the deployed API endpoint
```
REACT_APP_API_BASE_URL=https://.execute-api..amazonaws.com/dev
REACT_APP_AUTH0_DOMAIN=
REACT_APP_AUTH0_CLIENT_ID=
```- Build and deploy Frontend to host of your choosing and make sure to configure the `Allowed Callback URL`, `Allowed Logout URLs` and `Allowed Web Origins` in your auth0 application in the [auth0 dashboard](https://manage.auth0.com). I used `https://roasted-thread.surge.sh/` for the demo.
```bash
npm run buildserve build
```### 🗂 Resources
This example is based on [serverless examples](https://github.com/serverless/examples/tree/master/aws-node-auth0-cognito-custom-authorizers-api)
### 🥂 Contributing
Anyone and everyone is welcome to contribute.
### 🐞 Issues
Find a bug or want to request a new feature? Please let me know by submitting an issue.
### 🗝 Licensing
Licensed under the MIT License
A copy of the license is available in the repository's [LICENSE](LICENSE) file.