-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is Laravel Sanctum as a Provider on the roadmap? #10
Comments
Hey, have you check https://github.com/dystcz/nuxt-sanctum-auth ? |
I think I saw this one before but doesn't have full SSR support :( |
@Skylercrane23, let me shamelessly plug my own module, which handles SSR: https://github.com/nhedger/nuxt-sanctum Still ironing things out, and early feedback would be appreciated. |
I'm using Laravel Sanctum and here what I did to make it work. I've created a await setUserSession(event, {
user: {
...loginResponse?.user
},
loggedInAt: new Date()
// Any extra fields
})
return {status: 200, success: true} and on my login page logic const login = await $fetch("/api/auth/signin",{
method: 'POST',
body: JSON.stringify({
email: data?.email,
password: data?.password,
}),
headers: {
'Content-Type': 'application/json',
}.catch((resp) => console.log(resp))
if(login?.status === 200 && login?.success){
window.location.href = '/login'
} On your page, you can now retrieve the user session using the composable util const { loggedIn, user, session, clear } = useUserSession() |
Was curious if Laravel Sanctum is on the roadmap to becoming a provider. I currently use Nuxt Auth for my Nuxt2 Applications and really enjoyed how simple that was to get Laravel Sanctum working with. Have recently started several new Nuxt3 projects with a Laravel backend.
Any info would be great, Thanks!
The text was updated successfully, but these errors were encountered: