-
Notifications
You must be signed in to change notification settings - Fork 16
Added Auth.js based authentication #2
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
base: main
Are you sure you want to change the base?
Conversation
|
I've just realised that the Shall we add the |
julianfbeck
left a comment
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] }) | |
| })``` |
| "@auth/core": "^0.18.6", | ||
| "@auth/drizzle-adapter": "^0.3.12", | ||
| "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", |
| "@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-authintegrationauth.config.ts) with GitHub provider by default + Drizzle database adapter@auth/core@auth/drizzle-adapterauth-astroCommentFormcomponent/loginpage/loginif not logged in.example.envwith template environment variablesdefaultNameprop toCommentFormcomponentenv.d.ts