![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
next-protected-auth
Advanced tools
[![Maintainability](https://api.codeclimate.com/v1/badges/1c3d4f9f17d9514df0ec/maintainability)](https://codeclimate.com/github/flexper/next-protected-auth/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/1c3d4f9f17d9514df0ec/test_
Add protected routes to Next.js
// pages/_app.tsx
import type { AppProps } from 'next/app';
import { useNextAuthProtected } from 'next-protected-auth';
function MyApp({ Component, pageProps }: AppProps) {
const isConnected = useNextAuthProtected({
publicURLs: ['/'],
loginURL: '/auth/login',
authCallbackURL: '/auth',
renewTokenFct: (oldAccessToken) => {
//Your function to renew expired access Token
},
});
console.log('[USER] isConnected', isConnected);
return <Component {...pageProps} />;
}
export default MyApp;
// pages/auth/index.tsx
import { NextAuthProtectedCallback } from 'next-protected-auth';
export default NextAuthProtectedCallback({
callback: () => {
//Your function to redirect user after login
},
});
export default AuthCallback;
// pages/auth/login.tsx
import { NextAuthProtectedLogin } from 'next-protected-auth';
export default NextAuthProtectedLogin({
callback: () => {
//Your function to redirect to oauth portal
},
});
export default AuthCallback;
// pages/auth/logout.tsx
import { NextAuthProtectedLogout } from 'next-protected-auth';
export default NextAuthProtectedLogout({
preCallback: () => {
//Your function to tell to API that token is expired
},
callback: () => {
//Your function to redirect to home
},
});
Options
Field Name | Type | Description |
---|---|---|
callback | VoidFunction / AsyncVoidFunction | Specify a callback after login (generally redirect to oauth portal) |
Return: React Component
Options
Field Name | Type | Description |
---|---|---|
preCallback | VoidFunction / AsyncVoidFunction | Specify a callback before logout (generally send to api that user want to logout) |
callback | VoidFunction / AsyncVoidFunction | Specify a callback after logout (generally redirect to home) |
Return: React Component
Options
Field Name | Type | Description |
---|---|---|
callback | VoidFunction / AsyncVoidFunction | Specify a callback after auth callback (generally redirect to protected routes) |
Return: React Component
Options
Field Name | Type | Description |
---|---|---|
publicURLs | string[] | List of public URLs |
loginURL | string | Endpoint for login (ex: /auth/login) |
authCallbackURL | string | Endpoint for auth callback (ex: /auth) |
renewTokenFct | (oldAccessToken?: string) => string | Function who will run to renew token (ex: refresh token) |
Return: Hook who need to be use to pages/_app.tsx
This package use TSdx. Please check documentation to update this package.
FAQs
[![Maintainability](https://api.codeclimate.com/v1/badges/1c3d4f9f17d9514df0ec/maintainability)](https://codeclimate.com/github/qlaffont/next-protected-auth/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/1c3d4f9f17d9514df0ec/test
The npm package next-protected-auth receives a total of 236 weekly downloads. As such, next-protected-auth popularity was classified as not popular.
We found that next-protected-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.