Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Sending the authentication details to node js Serverless API #153

Open
khaledshamat opened this issue Mar 1, 2019 · 6 comments
Open

Sending the authentication details to node js Serverless API #153

khaledshamat opened this issue Mar 1, 2019 · 6 comments

Comments

@khaledshamat
Copy link

khaledshamat commented Mar 1, 2019

First of all, I would like to thank you for the great implementation, its very easy to play around with it and its readable, so I wanted to add some extra function to make a request to my secured Serverless API, which has the following configurations in the Serverless.yml file:
functions: get: # Defines an HTTP API endpoint that calls the main function in get.js # - path: url path is /orders/{id} # - method: GET request handler: src/orders/get.main events: - http: path: orders/{id} method: get cors: true authorizer: aws_iam

but every time the request is sent I get the following on my api cloud watch logs:

error: Object
message: "Missing Authentication Token"

Any advice please?

@mordka
Copy link

mordka commented Apr 2, 2019

You need to sign all API requests using sigv4. You can use amplify to do that https://aws-amplify.github.io/amplify-js/
Note, this repo was created before Amplify Cognito support. I would not use it as of 2019.

@tillkuhn
Copy link

@mordka Thanks for your hint. I actually also forked this project some time ago to build an application around it, but now heard multiple times it's no longer the recommended way to use Cognito in client side code. Can you recommend a similar Angular project based on Amplify that would will the gap and already and already covers a basic use cases? Sure, the docs are comprehensive, but some may not want to start from scratch, myself included :-)

@mordka
Copy link

mordka commented Jun 12, 2019

I can't recommend any good bootstrapping project in Amplify. There are some resources here: https://github.com/dabit3/awesome-aws-amplify but you can see Angular is not popular.
I would recommend starting from scratch for deeper understanding of the underlying services. From my experience working with Amplify is not a seamless experience, mainly because their team tries to catch many birds with one shot.

@fzhangj2ee
Copy link

@tillkuhn. Can you please provide any links why "it's no longer the recommended way to use Cognito in client side code.", is it because of Amplify?

@tillkuhn
Copy link

@fzhangj2ee I was more referring to this particular project, see also Issue 149 ! The project really keeps up its promise of giving you a "quick start", but it seem to be no longer actively maintained and I was feeling exactly the same as @mordka when I tried to customize my fork and keep it up to date with recent angular versions. I'm not blaming the author as it probably was just meant to be sample app. Maybe @mordka can elaborate further on this as I just realized it’s the same person who commented on the current issue here, also note I have no prior experience with Amplify but it’s now on my list of things to evaluate :-)

@tillkuhn
Copy link

Update for those who try to evaluate Amplify Cognito within a fresh Angular Project: This nice tutorial should get you started quickly and shows you how to overcome some common pitfalls.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants