npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auth0-nextjs-embedded

v1.0.3

Published

A Next.js/React custom hook for Auth0 embedded login.

Downloads

23

Readme

auth0-nextjs-embedded

This is a custom hook library where you can authenticate your user on the client side of Next.js with embedded login. It is based on the all client side library auth0.js build by Auth0.

Why this library when there is auth0-nextjs and auth0-react?

  1. Auth0 claims using embedded login will increase security vulnerabilities, so they only push universal login and would not recommend using embedded login.
  2. Auth0 provide us with the SDK nextjs-auth0 for Next.js - Auth0 authentication, some would suggest using an auth0 spa library, however they only support universal login.
  3. This library will enable you to authenticate user on client with embedded login, where you can customize and create a more seamless UX/UI for your website needs.

Release Downloads License

Documentation - Getting Started - API Reference - Feedback

Documentation

  • Options Basic configurations for Auth0
  • Types Types of each functions, configs and options.
  • Examples - code samples for common auth0-js authentication scenario's.

Getting started

Installation

From npm:

npm install auth0-nextjs-embedded

After installing the auth0-nextjs-embedded module using npm, you'll need to import the exposed hook useAuth0:

import { useAuth0 } from 'auth0-nextjs-embedded';

Configure the Hook

useAuth0(options: Auth0Config): Auth0Hook

initialize configuration for useAuth0 with your Auth0 basic information

const { user } = useAuth0({
  domain: '{YOUR_AUTH0_DOMAIN}',
  clientID: '{YOUR_AUTH0_CLIENT_ID}'
  ...
});

Auth0Hook: Describes the Auth0Hook interface comprehensively, detailing its properties (isAuthenticated, user, isLoading, error) and methods (signupAndAuthorize, login, loginWithSocialProvider, logout, parseHash, passwordReset, revalidate, checkSession).

API reference

Types

Many of the types and options are extended from the auth0.js library. Please check it with their documentations for detailed options.

| Type / Interface | Description | |---------------------------|-----------------------------------------------------------------| | Auth0Error | Error object used for Auth0-related errors. | | Auth0UserProfile | User profile object returned by Auth0 after authentication. | | AuthOptions | Options object used for configuring Auth0 authentication. | | ChangePasswordOptions | Options object for changing the user's password. | | CheckSessionOptions | Options object for checking the session status with Auth0. | | DbSignUpOptions | Options object for signing up a new user using a database connection in Auth0. | | LoginOptions | Options object for logging in a user. | | LogoutOptions | Options object for logging out a user. | | ParseHashOptions | Options object for parsing the hash after authentication. | | Auth0User | Interface representing an Auth0 user profile. Extends Auth0UserProfile. | | Auth0Config | Interface representing Auth0 configuration options. Extends AuthOptions. | | Auth0Hook | Interface representing a hook for Auth0 authentication management. Includes: - isAuthenticated: Boolean indicating if user is authenticated. - user: Current user profile (Auth0User or null). - isLoading: Boolean indicating if authentication operations are in progress. - error: Auth0 error object (Auth0Error or null). - Methods for authentication operations: - signupAndAuthorize(signUpForm: DbSignUpOptions): Sign up and authorize a user. - login(loginForm: LoginOptions): Log in a user. - loginWithSocialProvider(provider: Auth0SocialProvider): Log in with a social provider (Auth0SocialProvider). - logout(logoutOptions: LogoutOptions): Log out a user. - parseHash(hashOptions: ParseHashOptions): Parse authentication hash. - passwordReset(resetForm: ChangePasswordOptions): Reset user's password. - revalidate(checkSessionForm: CheckSessionOptions): Revalidate session. - checkSession(checkSessionForm: CheckSessionOptions): Check session status. | | Auth0SocialProvider | Type representing supported social providers for Auth0 authentication: "google-oauth2", "linkedin". |

Feedback

Contributing

More features are coming to encapsulte the auth0.js library from Auth0 for embedded login. I welcome and appreciate feedback and contribution to this repo!

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker.