Getting an authorizer to work #12104
Closed
jamesyoung-aus
started this conversation in
General
Replies: 1 comment
-
OK, never mind: I was hitting 'Test' from the console in AWS, instead of calling from e.g. the command line with curl. It's working. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there everyone,
I have found the serverless documentation to be lacking when it comes to authorizers.
I have a serverless function which I expect to call an authorizer before it runs, but I don't see any evidence that happened.
Here is a snippet from my serverless.yml:
provider:
httpApi:
authorizers:
customAuthorizer:
type: request
functionName: authorizerFunc
functions:
createVulnerabilities:
handler: src/handlers/demo/create.handler
events:
- httpApi:
path: /demo
method: post
authorizer:
name: customAuthorizer
authorizerFunc:
handler: src/handlers/auth/authorize.handler
The /demo function is getting invoked and that seems to be fine, but the problem is that there is no authorize step. It should find there is no token provided and return a 401.
Here is the authorizer code:
export const handler = async (event: APIGatewayTokenAuthorizerEvent): Promise => {
}
Shouldn't I see an error in the serverless console, or the function invocation show a status of 401?
Beta Was this translation helpful? Give feedback.
All reactions