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 Respostas
0
Resposta aceita

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
respondido há 5 anos
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
respondido há 5 anos
0

Thanks!

respondido há 5 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas