Socket
Socket
Sign inDemoInstall

@supabase/auth-js

Package Overview
Dependencies
Maintainers
9
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supabase/auth-js

Official client library for Supabase Auth


Version published
Weekly downloads
346K
increased by3.49%
Maintainers
9
Weekly downloads
 
Created

What is @supabase/auth-js?

@supabase/auth-js is a JavaScript library that provides authentication functionalities for Supabase, an open-source Firebase alternative. It allows developers to manage user authentication, including sign-up, sign-in, password recovery, and social logins, among other features.

What are @supabase/auth-js's main functionalities?

Sign Up

This feature allows users to sign up for an account using their email and password. The code sample demonstrates how to use the `signUp` method to create a new user.

const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');

async function signUp(email, password) {
  const { user, error } = await supabase.auth.signUp({
    email: email,
    password: password
  });
  if (error) console.error('Error signing up:', error);
  else console.log('User signed up:', user);
}

signUp('user@example.com', 'password123');

Sign In

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

const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');

async function signIn(email, password) {
  const { user, error } = await supabase.auth.signIn({
    email: email,
    password: password
  });
  if (error) console.error('Error signing in:', error);
  else console.log('User signed in:', user);
}

signIn('user@example.com', 'password123');

Password Recovery

This feature allows users to recover their password by sending a password recovery email. The code sample demonstrates how to use the `resetPasswordForEmail` method to initiate the password recovery process.

const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');

async function resetPassword(email) {
  const { data, error } = await supabase.auth.api.resetPasswordForEmail(email);
  if (error) console.error('Error sending password recovery email:', error);
  else console.log('Password recovery email sent:', data);
}

resetPassword('user@example.com');

Social Logins

This feature allows users to sign in using social login providers like GitHub, Google, etc. The code sample demonstrates how to use the `signIn` method with a provider to authenticate a user via social login.

const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');

async function signInWithProvider(provider) {
  const { user, session, error } = await supabase.auth.signIn({
    provider: provider
  });
  if (error) console.error('Error signing in with provider:', error);
  else console.log('User signed in with provider:', user);
}

signInWithProvider('github');

Other packages similar to @supabase/auth-js

Keywords

FAQs

Package last updated on 03 May 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