Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@next-auth/react-query
Advanced tools
@next-auth/react-query
React Query wrapper for NextAuth.js session management.
This is an alternative client for next-auth
based upon react-query
. It can replace the built-in session management on the client-side by taking advantage of react-query
's built-in caching, auto refetching, etc.
npm install --save @next-auth/react-query
You can then import useSession
from this package, instead of the core next-auth
package. More usage details can be found below.
useSession(params: UseSessionParams) : UseSessionResult
React Query wrapper to retrieve Session
. Replaces useSession
and Provider
from next-auth/client
in codebases where you already use react-query
.
import { useSession } from "@next-auth/react-query"
...
const [session, loading] = useSession({
required: true,
redirectTo: "/auth/sign-in?error=InvalidSession",
queryConfig: {
staleTime: 60 * 60 * 3, // 3 hours
refetchInterval: 60 * 5 // 5 minutes
}
})
...
Parameter | Type | Description | Default |
---|---|---|---|
required | boolean | If true , will redirect when no session available | false |
redrectTo | string | When required: true , this is where the user will be redirected | "/api/auth/session" |
queryConfig | UseQueryOptions | See React Query's useQuery Options | {} |
TIP:
staleTime
andrefetchInterval
respectively matchclientMaxAge
andkeepAlive
from the Original API.
import { useSession } from "@next-auth/react-query"
...
const [session, loading] = useSession()
...
The shape of what useSession
returns matches the Original API.
Based on this discussion between @kripod and @balazsorban44
We're open to all community contributions! If you'd like to contribute in any way, please first read our Contributing Guide.
ISC
FAQs
React Query wrapper for NextAuth.js session management
The npm package @next-auth/react-query receives a total of 18 weekly downloads. As such, @next-auth/react-query popularity was classified as not popular.
We found that @next-auth/react-query demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.