next-auth
next-auth copied to clipboard
feat: createSession hook for SolidStart & Hydration Fixes
then you can use the createSession hook:
import { createSession } from "@auth/solid-start/client"
const session = createSession()
const user = () => session()?.user
This will return a resource, in Solid a resource can be used to trigger suspense so this could be used like:
import { Show, type VoidComponent } from "solid-js"
import { A } from "solid-start"
import { createSession, signIn, signOut } from "~/auth/client"
const AuthShowcase: VoidComponent = () => {
const session = createSession()
return (
<div class="flex flex-col items-center justify-center gap-4">
<Show
when={session()}
fallback={
<button
onClick={() => signIn("discord", { redirectTo: "/" })}
class="rounded-full bg-white/10 px-10 py-3 font-semibold text-white no-underline transition hover:bg-white/20"
>
Sign in
</button>
}
>
<span class="text-xl text-white">Welcome {session()?.user?.name}</span>
<button
onClick={() => signOut({ redirectTo: "/" })}
class="rounded-full bg-white/10 px-10 py-3 font-semibold text-white no-underline transition hover:bg-white/20"
>
Sign out
</button>
</Show>
</div>
)
}
This also triggers suspense so the page will not be loaded until the session was passed.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| auth-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 22, 2023 9:33am |
1 Ignored Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| next-auth-docs | ⬜️ Ignored (Inspect) | Apr 22, 2023 9:33am |
@OrJDev is attempting to deploy a commit to the authjs Team on Vercel.
A member of the Team first needs to authorize it.
failing test has nothing to do with my changes
New dependency changes detected. Learn more about Socket for GitHub ↗︎
👍 No new dependency issues detected in pull request
Bot Commands
To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all
Pull request alert summary
| Issue | Status |
|---|---|
| Install scripts | ✅ 0 issues |
| Native code | ✅ 0 issues |
| Bin script shell injection | ✅ 0 issues |
| Unresolved require | ✅ 0 issues |
| Invalid package.json | ✅ 0 issues |
| HTTP dependency | ✅ 0 issues |
| Git dependency | ✅ 0 issues |
| Potential typo squat | ✅ 0 issues |
| Known Malware | ✅ 0 issues |
| Telemetry | ✅ 0 issues |
| Protestware/Troll package | ✅ 0 issues |
📊 Modified Dependency Overview:
| ➕ Added Package | Capability Access | +/- Transitive Count |
Publisher |
|---|---|---|---|
| [email protected] | None | +0 |
lukastaegert |