Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

@webiny/api-security-okta

Package Overview
Dependencies
9
Maintainers
1
Versions
162
Issues
File Explorer

Advanced tools

@webiny/api-security-okta

Security plugins for Okta

    5.34.7latest
    GitHub

Version published
Maintainers
1
Weekly downloads
927
increased by74.91%

Weekly downloads

Readme

Source

@webiny/api-security-cognito

code style: prettier PRs Welcome

A plugin that enables Amazon Cognito based authentication in @webiny/handler handlers.

Install

npm install --save @webiny/api-security @webiny/api-security-cognito

Or if you prefer yarn:

yarn add @webiny/api-security @webiny/api-security-cognito

Quick Example

The set up process consists only of a single step, and that's adding the plugins in your handler:

import { createHandler } from "@webiny/handler-aws"; import graphqlPlugins from "@webiny/handler-graphql"; import logsPlugins from "@webiny/handler-logs"; import securityPlugins, { SecurityIdentity } from "@webiny/api-security"; import cognitoAuthenticationPlugins from "@webiny/api-security-cognito"; // Imports plugins created via scaffolding utilities. import scaffoldsPlugins from "./plugins/scaffolds"; const debug = process.env.DEBUG === "true"; export const handler = createHandler({ plugins: [ securityPlugins(), cognitoAuthenticationPlugins({ region: process.env.COGNITO_REGION, userPoolId: process.env.COGNITO_USER_POOL_ID, identityType: "user" }), logsPlugins(), graphqlPlugins({ debug }), scaffoldsPlugins() ], http: { debug } });

With all the plugins in place, you should be able to retrieve the current identity in your handler application code, via the context.security object:

const identity = context.security.getIdentity();

FAQs

Last updated on 23 Mar 2023

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc