I am having trouble trying to set up a lambda authorizations for a WebSocket API.
Serverless.yml
functions:
sample-web-socket-authorizer:
iamRoleStatementsName: stack-${opt:stage}-web-socket-authorizer
iamRoleStatementsInherit: true
iamRoleStatements:
- Effect: "Allow"
Action:
- 'cognito-idp:*'
Resource: '*'
handler: sample-web-socket-authorizer/handler.handler
environment:
JWK_URL: ${self:custom.jwkUrl}
CLIENT_ID: ${self:custom.cognitoClientId}
...
connectionHandler:
handler: handler.connectionHandler
events:
- websocket:
route: $connect
authorizer:
name: sample-web-socket-authorizer
identitySource:
- 'route.request.querystring.Authorizer'
in frontend i want to send a tokenId or accessToken to use in authorizer
wss://abcd1234.execute-api.ap-region-1.amazonaws.com/pre?Authorizer=${token}
Can u guys please give me a sample code using python to create a lambda authorizer for my websocket api.
I am currently looking at these article: https://github.com/awslabs/aws-support-tools/blob/master/Cognito/decode-verify-jwt/decode-verify-jwt.py