I have an API gateway get method. I can test it successfully using the test function. It calls a lambda function and returns sucessfully. However, copying the invoke URL of API gateway function into a broswer, I get the following error message:
{"message": "Missing Authentication Token"}
I created an authorizer for my api gateway type is Lambda function Token source: method.request.header.Authorization Token validation - optional: None
我设立了授权的Lambda职能,作为以下法典:
export const handler = async (event) => {
const token = event.authorizationToken;
const policy = {
principalId: user123 , // Unique identifier for the user
policyDocument: {
Version: 2012-10-17 ,
Statement: [
{
Action: execute-api:Invoke ,
Effect: Allow ,
Resource: arn:aws:execute-api:eu-north-1:xxx:c8mhri79ja/prod/*/* ,
},
],
},
};
return policy;
};
我设立了VPC,在为我的其他Lambda职能设置的安保小组后,我试图通过一个网关电话。
AWSLambdaBasic ExecutionRole政策规定,与授权者Mlambda共同执行。
如果我从AAP网关处进行测试,则不会发生错误。 SO 门户和Mlambda功能正确运作。
如果在“URL”案的结尾处加上资源名称,我收到以下错误信息:
{"message": "Unauthorized"}
why I get the same arror message as I got without setting any Authorizers? How can I get rid of the error?