Created
January 20, 2021 03:46
-
-
Save justindra/05f6e586c5f993293c4ef4c3b6afcf09 to your computer and use it in GitHub Desktop.
Auth0-Authorizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Expired Token Gateway Response | |
new GatewayResponse(this, 'ExpiredTokenGatewayResponse', { | |
restApi: api, | |
type: ResponseType.EXPIRED_TOKEN, | |
statusCode: '401', | |
templates: { | |
'application/json': JSON.stringify({ | |
message: 'Provided token is expired', | |
}), | |
}, | |
}); | |
// Unauthenticated Gateway Response | |
new GatewayResponse(this, 'UnauthenticatedGatewayResponse', { | |
restApi: api, | |
type: ResponseType.UNAUTHORIZED, | |
statusCode: '401', | |
templates: { | |
'application/json': JSON.stringify({ | |
message: '$context.error.message', | |
}), | |
}, | |
}); | |
// Unauthorized Gateway Response | |
new GatewayResponse(this, 'UnauthorizedGatewayResponse', { | |
restApi: api, | |
type: ResponseType.ACCESS_DENIED, | |
statusCode: '403', | |
templates: { | |
'application/json': JSON.stringify({ | |
message: '$context.authorizer.errorMessage', | |
}), | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment