
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
next-auth-navigation
Advanced tools
NextJS Library for authentication
// with npm
npm i next-auth-navigation
// with yarn
yarn add next-auth-navigation
It is a NextJS Library for user authentication in client / server side. It provides basic HOC's that to wrap around pages to authenticate user very easily.
next-auth-navigation only provides 2 helpful hocs to define user authentication in client / server side. Both hocs must be used for authentication.
withAuth() accepts a component for which we wan an authentication as a first argument and options as a second argument. options
Let us configure the second argument.
withAuthServerSideProps() is used instead of getServerSideProps() function on a page with withAuth() hoc. It is used to authenticate user in server-side. options is passed as a first optional argument where we can specify redirectUri or authenticatedUri for server-side redirection. callback function can be provided as second argument which acts as a getServerSideProps() function with context as a first argument and data as a second argument reffering all cookie data.
Example
import { withAuth, withAuthServerSideProps } from "next-auth-navigation";
function Home() {
return <div>HOME PAGE</div>;
}
export default withAuth(Home, {
redirectUri: "/login",
});
export const getServerSideProps = withAuthServerSideProps();
MIT © dipeshrai123
FAQs
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.