Skip to content
Discussion options

You must be logged in to vote

Turns out, the oauth_token & oauth-token_secret is stored in Account schema so I used prisma to solve this by checking for session.username which I already store as above.

[...nextauth.ts]

session: {
	jwt: false,
},
callbacks: {
	async signIn({ user, profile }) {
		if (profile) {
			user.username = profile.screen_name
		}
		return true
	},
	async session({ session, user }) {
		session.username = user.username
		return session
	},
},

search.ts

import { NextApiRequest, NextApiResponse } from 'next'
import { TwitterApi } from 'twitter-api-v2'
import { getSession } from 'next-auth/react'

import prisma from '@/server/db/prisma'

const search = async (req: NextApiRequest, res: NextApiResponse) =>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@balazsorban44
Comment options

Answer selected by deadcoder0904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants