svdgraaf/serverless-basic-authentication

Tried the npm plugin verbatim

jnguyen32 opened this issue · 3 comments

Getting this issue:

{"message":"Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization=Basic xxx"}

When I attempt to:

curl -u key:value endpoint

Is there something missing from the documentation?

I guess there is :D

I have some time this week to spend on this, so I expect this to be fixed / documented :)

@jnguyen32 I just tried this with a new api, and everything seems to work (aside from a missing dependency) out of the box.

Are you sure you are sending the credentials correctly? In your api there should be an authorizer configured:

screenshot 2019-01-14 10 10 07

The api key source source should be set to authorizer:
screenshot 2019-01-14 10 10 44

Your function should look a little like this:
screenshot 2019-01-14 10 11 54
screenshot 2019-01-14 10 12 39

This should all be configured automatically out of the box when you install the plugin and set your function to something like this:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: foo/bar
          method: get
          private: true

Let me know if this is the case, and I'll help you debug :)

Closing this because of no response, if you're still having this issue, please let me know