So I have an api route that I'd normally want to b...
# help
a
So I have an api route that I'd normally want to be protected by IAM, but if the user checks a box, I'd want it to be publicly accessible. Any idea how to do that with SST? I've tried setting it to
authorizationType: sst.ApiAuthorizationType.NONE
but then in the lambda, the
requestContext.authorizer
is actually undefined.
I guess I could do it with two different routes, and only check the flag in the publicly accessible one, but trying to avoid having to set up multiple routes for this
r
Where is the user checking the box? At runtime?
a
yeah
r
I guess you could define a custom authorizer and then do a check inside that as to whether to authenticate or allow
a
sounds interesting, I'll check it out, thanks