Next.js Discord

Discord Forum

Very little user data showing up when using database

Cirneco dell'Etna posted this in #help-forum
Open in Discord
Cirneco dell'EtnaOP
For some reason, when using the mongodb adapter for user accounts, it doesn't show much information for the session

I setup the mongodb client according to the docs so i'm stumped, heres my [...nextAuth].ts file (using pages)
import NextAuth, { AuthOptions } from "next-auth";
import {
} from "@/lib/robloxProvider";
import { MongoDBAdapter } from "@auth/mongodb-adapter";
import clientPromise from "@/lib/mongoClient";

export const authOptions = {
  secret: process.env.AUTH_SECRET,
  // Configure one or more authentication providers
  providers: [
      clientId: process.env.ROBLOX_ID,
      clientSecret: process.env.ROBLOX_SECRET,
      scopes: ["openid", "profile", "group:read"],
      redirectUri: "http://localhost:3000/api/auth/callback/roblox",
      include: ["name", "displayName", "avatar"],
    // ...add more providers here
  adapter: MongoDBAdapter(clientPromise, {
    databaseName: "data",
  callbacks: RobloxProviderCallbacks_Jwt,
} satisfies AuthOptions;

export default NextAuth(authOptions); (without adpater) (with adapter)

4 Replies

Cirneco dell'EtnaOP
if this has anything to do with it, since there is no official roblox oauth provider i am using a community-made one, so maybe it doesn't support databses or something
Cirneco dell'EtnaOP
apparently it has to do with how it was made, "By default, only a subset of the token is returned for increased security"
however im using the database as the session and i need more stuff from the token than what i'm given, but it doesn't call the JWT
also i'm using mongodb as my database so it overwrites my userId as the object id