Amplify-js: [FEATURE] Allow for @aws-amplify/auth configure to set an endpoint

Created on 20 Jun 2019  路  2Comments  路  Source: aws-amplify/amplify-js

Is your feature request related to a problem? Please describe.

AWS cognito exposes a URL that we are meant to use in order to consume the service. e,g https://cognito-idp.eu-west-1.amazonaws.com/

Said cognito URL and params to make a request are out in the public to see when amplify is being used as a client-side library.

That leaves a room open for attackers to use and abuse the endpoint.

As a solution, a development team can set a forward proxy service to be behind their own CDN in order to conceal the fact Cognito is being used and programmatically implement strategies like rate-limiting, WAF IP blacklisting, etc.

However, the SDK does not allow for an end user to set up an endpoint.

Describe the solution you'd like

I would like the Auth.configure(); method to be able to take in the endpoint param. e,g:

      Auth.configure({
       endpoint: config('PROXIED_ENDPOINT'),
        region: config('COGNITO_REGION'),
        userPoolId: config('COGNITO_USER_POOL'),
        userPoolWebClientId: config('COGNITO_CLIENT_ID'),
      })

This would:

  • Give the end users a lot more control over what could potentially be happening and going through Cognito

  • Make testing a lot easier.

Cognito Service Team feature-request needs-discussion

Most helpful comment

The CognitoUserPool supports the endpoint argument (https://github.com/aws-amplify/amplify-js/blob/master/packages/amazon-cognito-identity-js/src/CognitoUserPool.js#L36) it just needs to be passed on to it

All 2 comments

The CognitoUserPool supports the endpoint argument (https://github.com/aws-amplify/amplify-js/blob/master/packages/amazon-cognito-identity-js/src/CognitoUserPool.js#L36) it just needs to be passed on to it

In case you are still experiencing this issue: We've created a small library [email protected] that provides an amplifylocal CLI to use Amplify and deploy applications entirely against local APIs (e.g., LocalStack).

This first version we created is only a starting point - it applies simple runtime patching to configure custom endpoints and test credentials.

Perhaps it can help support your use case well - please feel free to suggest new features in this repo. We'll be happy to incorporate any changes that may simplify using Amplify with custom endpoints. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ddemoll picture ddemoll  路  3Comments

leantide picture leantide  路  3Comments

shinnapatthesix picture shinnapatthesix  路  3Comments

DougWoodCDS picture DougWoodCDS  路  3Comments

ldgarcia picture ldgarcia  路  3Comments