-
Notifications
You must be signed in to change notification settings - Fork 14
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
Added Auth.js based authentication #2
base: main
Are you sure you want to change the base?
Conversation
I've just realised that the Shall we add the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, Thanks for your pr! I wanted to use auth with lazy stack and found your open PR :)
i just testet it and needed to adjust a view things to get it working for me :)
clientId: import.meta.env.GITHUB_CLIENT_ID, | ||
clientSecret: import.meta.env.GITHUB_CLIENT_SECRET | ||
}) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
] | |
], | |
callbacks: { | |
session({ session, user }) { | |
if (session.user) { | |
session.user.id = user.id; | |
} | |
return session; | |
} | |
} |
This adds the id field to the session.user
object. Otherwise you wont retrieve the user id on
(account) => ({ | ||
compoundKey: primaryKey(account.provider, account.providerAccountId) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(account) => ({ | |
compoundKey: primaryKey(account.provider, account.providerAccountId) | |
}) | |
(account) => ({ | |
compoundKey: primaryKey({ | |
columns: [account.provider, account.providerAccountId] | |
}) | |
}) |
token: text('token').notNull(), | ||
expires: integer('expires', { mode: 'timestamp_ms' }).notNull() | ||
}, | ||
(vt) => ({ compoundKey: primaryKey(vt.identifier, vt.token) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(vt) => ({ compoundKey: primaryKey(vt.identifier, vt.token) }) | |
(vt) => ({ | |
compoundKey: primaryKey({ columns: [vt.identifier, vt.token] }) | |
})``` |
"astro": "^4.0.8", | ||
"auth-astro": "^4.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"auth-astro": "^4.1.0", | |
"auth-astro": "^4.1.1", |
@@ -14,7 +14,10 @@ | |||
"@astrojs/check": "^0.3.4", | |||
"@astrojs/node": "^7.0.3", | |||
"@astrojs/tailwind": "^5.1.0", | |||
"@auth/core": "^0.18.6", | |||
"@auth/drizzle-adapter": "^0.3.12", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"@auth/drizzle-adapter": "^0.3.12", | |
"@auth/drizzle-adapter": "^0.5.0", |
I had to update this adapter
What's been changed?
astro-auth
integrationauth.config.ts
) with GitHub provider by default + Drizzle database adapter@auth/core
@auth/drizzle-adapter
auth-astro
CommentForm
component/login
page/login
if not logged in.example.env
with template environment variablesdefaultName
prop toCommentForm
componentenv.d.ts