Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ Create a `.env` file at the root of the project. Add the following environment v
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# setup SSO with Twitter
TWITTER_API_KEY=
TWITTER_API_KEY_SECRET=

# database
DATABASE_URL=postgres://postgres:holaplex@localhost:5432/hub-starter
POSTGRES_DB=hub-starter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Account" ADD COLUMN "oauth_token" TEXT,
ADD COLUMN "oauth_token_secret" TEXT;
2 changes: 2 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ model Account {
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
oauth_token String? @db.Text
oauth_token_secret String? @db.Text
expires_at Int?
token_type String?
scope String?
Expand Down
8 changes: 7 additions & 1 deletion src/app/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ export default function Login() {
className='rounded-lg px-20 py-3 bg-cta text-black hover:opacity-80 transition'
onClick={() => signIn('google')}
>
Continue with Google
Sign in with Google
</button>
<button
className='rounded-lg px-20 py-3 bg-cta text-black hover:opacity-80 transition'
onClick={() => signIn('twitter')}
>
Sign in with Twitter
</button>
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import NextAuth from "next-auth";
import GoogleProvider from "next-auth/providers/google";
import TwitterProvider from "next-auth/providers/twitter";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import type { NextAuthOptions } from "next-auth";
import prisma from "@/modules/db";
Expand Down Expand Up @@ -74,6 +75,10 @@ export const authOptions: NextAuthOptions = {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
}),
TwitterProvider({
clientId: process.env.TWITTER_API_KEY as string,
clientSecret: process.env.TWITTER_API_KEY_SECRET as string,
})
],
events: {
async createUser({ user }) {
Expand Down