To get the lists I need to authenticate and to authenticate I can only use Implicit Grant. This means the user has to manually log in to get redirected back to the app, but I don't want that as I'm using AWS Cognito for login and I don't want the user to log in twice. Client Creds login doesn't work in a browser. So, what's the correct way to do this? Should I get the lists via a Lambda function where, presumably, I could use client creds?
Hi Tim, so what are my options? My aim is to use a list of users and queues in a 3rd party app. I don't want the user to have to log in manually to get these lists. If I wrote the function to return lists in a Lambda function, could I use client credentials?
If the code above is all your code, I wouldn't expect it to. You define but never invoke the queues function. Even if you do invoke it, this lambda will always return the status code of 200 with the body of done because the the return retValue; statement will be run before the asynchronous response to the API request is processed.
To answer this directly, your options are to use the implicit grant in your client-side app or change your architecture to include a server-side component that can safely handle client credentials and is access-restricted to authorized users of your web app. Using API Gateway and a lambda function with an authorizer is a good example of the latter.