Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-amplify/auth

Package Overview
Dependencies
Maintainers
9
Versions
2190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-amplify/auth

Auth category of aws-amplify

  • 6.8.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
870K
increased by8.58%
Maintainers
9
Weekly downloads
 
Created

What is @aws-amplify/auth?

@aws-amplify/auth is a part of the AWS Amplify library that provides authentication functionalities for web and mobile applications. It allows developers to easily integrate authentication and authorization features into their applications using AWS Cognito.

What are @aws-amplify/auth's main functionalities?

Sign Up

This feature allows users to sign up for an account. The code sample demonstrates how to use the signUp method to create a new user with a username, password, and additional attributes like email and phone number.

const { Auth } = require('@aws-amplify/auth');

Auth.signUp({
  username: 'username',
  password: 'password',
  attributes: {
    email: 'email@example.com',
    phone_number: '+1234567890'
  }
}).then(data => console.log(data)).catch(err => console.log(err));

Sign In

This feature allows users to sign in to their account. The code sample demonstrates how to use the signIn method to authenticate a user with a username and password.

const { Auth } = require('@aws-amplify/auth');

Auth.signIn('username', 'password')
  .then(user => console.log(user))
  .catch(err => console.log(err));

Sign Out

This feature allows users to sign out of their account. The code sample demonstrates how to use the signOut method to log out the current user.

const { Auth } = require('@aws-amplify/auth');

Auth.signOut()
  .then(data => console.log(data))
  .catch(err => console.log(err));

Password Reset

This feature allows users to reset their password. The code sample demonstrates how to use the forgotPassword method to initiate a password reset and the forgotPasswordSubmit method to complete the password reset process.

const { Auth } = require('@aws-amplify/auth');

Auth.forgotPassword('username')
  .then(data => console.log(data))
  .catch(err => console.log(err));

Auth.forgotPasswordSubmit('username', 'code', 'new_password')
  .then(data => console.log(data))
  .catch(err => console.log(err));

User Attributes

This feature allows users to update their attributes. The code sample demonstrates how to use the currentAuthenticatedUser method to get the current user and the updateUserAttributes method to update the user's attributes.

const { Auth } = require('@aws-amplify/auth');

Auth.currentAuthenticatedUser()
  .then(user => {
    return Auth.updateUserAttributes(user, {
      'custom:attribute': 'value'
    });
  })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Other packages similar to @aws-amplify/auth

FAQs

Package last updated on 03 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc