Set up WebSocket API with AWS_IAM auth using CloudFormation template

0

We are trying to set up a REST API and a WebSocket API on APi Gateway using CloudFormation template.

For the REST API, only the IAM user's access key and secret key would be required to instantiate a connection (using presignedURL with Signature v4). We would want the exact same authorization method for the WebSocket API.

The REST API template:

RestApi:
    Type: AWS::Serverless::Api
    Properties:
      Auth:
        DefaultAuthorizer: AWS_IAM
      (other properties)...

The closest thing we've found is to set the value of AuthorizationType inside the $connect route to AWS_IAM.

WebsocketConnectRoute:
    Type: AWS::ApiGatewayV2::Route
    Properties:
      RouteKey: $connect
      AuthorizationType: AWS_IAM
      (other properties)...

However the same authorization method does not seem to work with WebSocket API as it throws an error with message The security token included in the request is invalid.

Is there any way to set up authorization without the need of "security token"? Or, where can we gather this "security token" to pass the authorization?

답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인