Using Social Providers without a database

Is it possible to use social providers, specifically cognito as a provider without and am i doing something wrong. I have set up better auth with cognito and I keep getting a
Using memory adapter in development
warning but things seem to be fine, Is this ok in production? Then when I try and sign up a user I get a State Mismatch. Verification not found.

I want to not have a db as all of the information is should be stored in cognito and my frontend does not have acess to my main db.

Below is my configuration, any help would be appreciated thank you!


import { betterAuth } from "better-auth";

export const auth = betterAuth({
  baseURL: process.env.BETTER_AUTH_URL as string,
  socialProviders: {
    cognito: {
      clientId: process.env.COGNITO_CLIENT_ID as string,
      clientSecret: process.env.COGNITO_CLIENT_SECRET as string,
      domain: process.env.COGNITO_DOMAIN as string,
      region: process.env.COGNITO_REGION as string,
      userPoolId: process.env.COGNITO_USERPOOL_ID as string,
    },
  },
})

export type Session = typeof auth.$Infer.Session;

import { createAuthClient } from "better-auth/react";

export const authClient = createAuthClient({
  baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL || "http://localhost:3000",
  session: { strategy: "jwt" },
  adapter: null as any,
});

export type Session = typeof authClient.$Infer.Session;
Was this page helpful?