serverless / serverless/examples

aws-node-auth0-custom-authorizers-api Private API returned 401

Open
#411 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.5k
Forks
4.4k
Avg merge
2h 55m
Merged PRs (30d)
3

Description

I tried running aws-node-auth0-custom-authorizers-api. It logins successfully, public API is called successfully. But private API returns 401 with following error:

I had make a few changes also:

  1. Add algorithms: ["HS256"] to options passed to jwt.verify().
  2. Change AUTH0_CLIENT_PUBLIC_KEY to new Buffer(AUTH0_CLIENT_PUBLIC_KEY, "base64") when passing to jwt.verify().
verifyError { JsonWebTokenError: invalid signature
at /var/task/node_modules/jsonwebtoken/verify.js:133:19
at getSecret (/var/task/node_modules/jsonwebtoken/verify.js:90:14)
at Object.module.exports [as verify] (/var/task/node_modules/jsonwebtoken/verify.js:94:10)
at module.exports.auth (/var/task/handler.js:45:9) name: 'JsonWebTokenError', message: 'invalid signature' }

I am using serve for hosting frontend locally. FE is live on http://localhost:5000/

Any suggestions?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with handler.js around line 45, where the stack trace shows jwt.verify() failing, and compare the token and verification configuration used by the public and private API paths. Reproduce the example with the documented local frontend setup and inspect the authorizer logs. Done means a valid login token is accepted by the private API without the invalid-signature 401.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
api, authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.