Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.68 KB

README.md

File metadata and controls

55 lines (40 loc) · 1.68 KB

Feathers Cognito

Feathers App with AWS Cognito Authentication

Configuration

Ensure that the required OAuth Scopes are allowed in the Cognito User Pool App client settings and the callback url is whitelisted.

Environment variables

Cognito configuration is specified in config/default.json or config/production.json.

"cognito": {
  "authorizationURL": "COGNITO_AUTH_URL",
  "callbackURL": "http://localhost:3030/auth/cognito/callback",
  "clientID": "COGNITO_CLIENTID",
  "clientSecret": "COGNITO_CLIENT_SECRET",
  "tokenURL": "COGNITO_TOKEN_URL",
  "userProfileURL": "COGNITO_USER_URL",
  "scope": [
    "openid",
    "profile",
    "email"
  ],
  "successRedirect": "http://localhost:3030/"
}

The following configurations needs to be configured using environment variables.

Variable Example Value
COGNITO_AUTH_URL https://xxx.auth.ap-southeast-1.amazoncognito.com/oauth2/authorize
COGNITO_CALLBACK_URL http://hostname/auth/cognito/callback
COGNITO_CLIENTID app_client_id
COGNITO_TOKEN_URL https://xxx.auth.ap-southeast-1.amazoncognito.com/oauth2/token
COGNITO_USER_URL https://xxx.auth.ap-southeast-1.amazoncognito.com/oauth2/userInfo

Alternatively, a local.json file can be created to override default.json.

Logging In

# Install dependencies
npm install

# Start server
npm run dev

# Login URL: http://localhost:3030/auth/cognito/

# feathers-jwt cookie will be created.