I am trying to call the trialfunction, have the jwt be verified by the auth function, have the auth function pass the scopes back through the context to the trialfunction , verify the scopes, and return the response of the trialfunction . From what I have read, and based on the serverless youtube course I followed, the context should be found in event.requestContext.authorizer. Unfortunately, for me this is not happening. Currently, my trialfunction returns ‘no scopes provided’. This is what I get back in the relevant section of the trialfunction event object:
I originally posted this on stack overflow, but maybe this community can help more. See full post and code here:
I had a look through your SO post and it seems like you’re doing everything you should be. I’ve been using custom authorizers heavily over the past few years and passing data to functions via the authorzier response too.
My guess is there is a minor error in your auth function code somewhere but I can’t see it.
I take it from seeing your console.log(authResponse); line in the generatePolicy function that you’re seeing the authResponse object with the scopes in the context?
I’d double check the authorizer is returning what you’re expecting it to be returning then go from there.
For some 3rd party documentation on custom authorizers I’ve found this article to be an excellent reference.
Thanks for taking a look. I managed to get it working, but similarly to the post which I linked to, I don’t know why. Seems like the solution is sleep on it and come back with fresh eyes.