Websockets Authorizer function is not triggered by Querystring identifier

0

When changing the Identifier of our Authorizer function from sourcetype Header to sourcetype Querystring our Authorization Lambda was not starting up and created no logs.

as an example:
https://i.imgur.com/IYCasYp.png

()=>new WebSocket('wss://x0x0x0x0x0.execute-api.eu-central-1.amazonaws.com/dev?authorizationToken=' + headers.Auth)
3 Answers
0
Accepted Answer

According to your screenshot, you didn't change the identity source but you added additional identity source. Unless the request has both header and query string, your authorizer will not be triggered.
If you want to use query string, remove the header identity source.

AWS
answered 5 years ago
0

Hi,

I have taken the topic from sahin at GPMES.

We had multible problems, which has been solved now.

  1. Yes, there can only be one identity source. With multible sources it is not working.
  2. A Cloudformation deploy is not updating the api gateway directly. We have to deploy the updated api description with boto3 or aws cli
  3. route.request.querystring.authorizationToken is not working. we switched to route.request.querystring.token, which is working well. I don't know, authorizationToken is to long as querystring or something else ...

My cloudformation block looks now like this:

AuthorizerFuncWebsocketsAuthorizer:
  Type: 'AWS::ApiGatewayV2::Authorizer'
  Properties:
    ApiId: !Ref WebsocketsApi
    Name: !Sub ${AWS::StackName}-cognito-auth
    AuthorizerType: REQUEST

    AuthorizerUri:
      Fn::Sub:
        arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiCognitoAuthenticatorApi.Arn}/invocations
    IdentitySource:
      - route.request.querystring.token
pkgp
answered 5 years ago
0

Thanks!

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions