{"id":16323725,"url":"https://github.com/shavo007/custom-authoriser-api-key","last_synced_at":"2026-02-21T20:33:00.956Z","repository":{"id":41888402,"uuid":"132221906","full_name":"shavo007/custom-authoriser-api-key","owner":"shavo007","description":"showcase aws api gateway and custom authoriser api key","archived":false,"fork":false,"pushed_at":"2026-02-12T14:06:01.000Z","size":520,"stargazers_count":1,"open_issues_count":17,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-12T22:48:03.196Z","etag":null,"topics":["aws-apigateway","aws-lambda","node-js","serverless"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shavo007.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-05-05T06:38:34.000Z","updated_at":"2023-03-31T16:24:30.000Z","dependencies_parsed_at":"2025-12-03T05:08:48.141Z","dependency_job_id":null,"html_url":"https://github.com/shavo007/custom-authoriser-api-key","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shavo007/custom-authoriser-api-key","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fcustom-authoriser-api-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fcustom-authoriser-api-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fcustom-authoriser-api-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fcustom-authoriser-api-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shavo007","download_url":"https://codeload.github.com/shavo007/custom-authoriser-api-key/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fcustom-authoriser-api-key/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29692521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T18:18:25.093Z","status":"ssl_error","status_checked_at":"2026-02-21T18:18:22.435Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-apigateway","aws-lambda","node-js","serverless"],"created_at":"2024-10-10T22:55:30.699Z","updated_at":"2026-02-21T20:33:00.925Z","avatar_url":"https://github.com/shavo007.png","language":"JavaScript","readme":"# custom-authoriser-api-key\n\nShowcase how to use a custom authoriser to  attach api key\n\nThis project uses [Serverless Node.js Starter](https://github.com/shavo007/serverless-nodejs-starter) that includes [serverless-webpack](https://github.com/serverless-heaven/serverless-webpack) plugin, [Babel](https://babeljs.io), and [Mocha](https://mochajs.org/). It supports:\n\n- **ES7 syntax in your handler functions**\n  - Use async/await\n  - And much more!\n- **Run API Gateway locally**\n  - Use `yarn serve`\n- **Support for unit tests**\n  - Run `yarn test:unit` to run your tests\n- **Sourcemaps for proper error messages**\n  - Error message show the correct line numbers\n  - Works in production with CloudWatch\n- **Automatic support for multiple handler files**\n  - No need to add a new entry to your `webpack.config.js`\n- **Add environment variables for your stages**\n\n\n\n## Install\n\n* Yarn\n\n1. `curl -o- -L https://yarnpkg.com/install.sh | bash`\n2. `yarn bash completion` - https://github.com/dsifford/yarn-completion\n\n\n\n```bash\n\n# Install dependencies\nyarn install\n```\n\n\n\n#### 3. Create your custom domain\n\n```yaml\ncustomDomain:\n    domainName: shane.shanelee.xyz\n    certificateName: '*.shanelee.xyz'\n    basePath: ''\n    stage: ${self:provider.stage}\n    createRoute53Record: true\n    endpointType: 'regional'\n\n```\n\nTo create the custom domain\n\n**Make sure and change the values to suit your needs**\n\n`sls create_domain --stage dev`\n\n\n### API Gateway-like local dev server\n\nTo spin up a local dev server that will more closely match the API Gateway endpoint/experience:\n\n```bash\nyarn serve\n```\n\n\n### Renovate\n\n\u003e Automated Dependency Updates\n\nRenovate runs continuously to detect the latest available versions. And automagicaly creates PR on your github project with changelog and release notes.\n\nFor more info and how to authorise the github app check out [onboarding guide](https://renovateapp.com/docs/getting-started/configure-renovate)\n\n## Deploy\n\nAssuming you've already set up your default AWS credentials\n\n`yarn deploy:dev` will deploy to \"dev\" environment.\n\n## Expose API Key Source\n\nAfter you've deployed, the output of the deploy script will give you the API endpoint\nfor your deployed function(s), and most importantly the **api key value**\n\nCopy this value into the custom authoriser variable `usageIdentifierKey` located at [`./src/authoriser.js`](./src/authoriser.js)\n\n**the Lambda authorizer Lambda function must also return an API key of the usage plan as the usageIdentifierKey property value**\n\nUnder the API Key Source section in the Settings pane for API Gateway console, choose `AUTHORIZER` from the drop-down list. Save changes and then you need to redeploy your service\n\n```bash\nyarn deploy:dev\n```\n\nThe client can now call the API key-required methods without explicitly supplying any API key. The authorizer-returned API key is used automatically. So you should be able to test the deployed API via that URL.\n\n\n```bash\n\n$ curl -H 'Authorization: Bearer xxx' 'https://xyz.execute-api.us-east-1.amazonaws.com/dev/hello'\n{\"message\":\" Hello world Your function executed successfully! (with a delay)\"}\n\n```\n\nSee.. No API Key Needed!!\n\n## Useful links\n* https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html#api-gateway-api-usage-plans-overview\n\n* https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html\n\n* https://aws.amazon.com/about-aws/whats-new/2017/12/amazon-api-gateway-supports-api-keys-in-custom-authorizer-responses/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshavo007%2Fcustom-authoriser-api-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshavo007%2Fcustom-authoriser-api-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshavo007%2Fcustom-authoriser-api-key/lists"}