"consent" does not exits #749

Closed
opened 2026-03-13 08:02:47 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @Siddhisalvi on GitHub (Feb 27, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Was trying oauth of betterauth and came across this weird error even tho I am doing what demo/nextjs code in github said.

Current vs. Expected behavior

"use client";

import { Button } from "@/components/ui/button";
import { CardFooter } from "@/components/ui/card";
import { authClient } from "@/lib/auth-client";
import { useState } from "react";



export function ConsentButton() {
    const [loading, setLoading] =useState(false);

    return (
        <CardFooter className="felx items-center gap-2">
            <Button onClick={async () => {
                setLoading(true);
                const res = await authClient.oauth2.consent({
                    accept: true,
                });
                setLoading(false);
                if (res.data?.redirectURI) {
                    window.location.href = res.data.redirectURI;
                }
            }}>

            </Button>
        </CardFooter>
    )
}


error in: consent: Property 'consent' does not exist on type '{ callback: { ":providerid": <FetchOptions extends { cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; headers?: (HeadersInit & (HeadersInit | CommonHeaders)) | undefined; ... 32 more ...; disableValidation?: boolean | undefined; }>(data_0: Prettify<...>, data_1?: FetchOptions | undefin...'.ts(2339)
any 

please help me!!

What version of Better Auth are you using?

"better-auth": "^1.1.21",

Provide environment information

window 11

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)

import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { PrismaClient } from "@prisma/client";
import { oAuthProxy } from "better-auth/plugins";
import { nextCookies } from "better-auth/next-js";

const prisma = new PrismaClient();
export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: "postgresql", // or "mysql", "postgresql", ...etc
  }),

  account: {
    accountLinking: {
      enabled: true,
      trustedProviders: ["google"],
    },
  },

  socialProviders: {
    google: {
      clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || "",
      clientSecret: process.env.GOOGLE_CLIENT_SECRET || "",
    },
  },

  plugins: [oAuthProxy(), nextCookies()],

  session: {
    cookieCache: {
      enabled: true,
      maxAge: 30 * 24 * 60 * 60,
      secure: process.env.NODE_ENV === "production",
      sameSite: "lax",
      httpOnly: true,
    },
  },
});

Additional context

No response

Originally created by @Siddhisalvi on GitHub (Feb 27, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Was trying oauth of betterauth and came across this weird error even tho I am doing what demo/nextjs code in github said. ### Current vs. Expected behavior ``` "use client"; import { Button } from "@/components/ui/button"; import { CardFooter } from "@/components/ui/card"; import { authClient } from "@/lib/auth-client"; import { useState } from "react"; export function ConsentButton() { const [loading, setLoading] =useState(false); return ( <CardFooter className="felx items-center gap-2"> <Button onClick={async () => { setLoading(true); const res = await authClient.oauth2.consent({ accept: true, }); setLoading(false); if (res.data?.redirectURI) { window.location.href = res.data.redirectURI; } }}> </Button> </CardFooter> ) } error in: consent: Property 'consent' does not exist on type '{ callback: { ":providerid": <FetchOptions extends { cache?: RequestCache | undefined; credentials?: RequestCredentials | undefined; headers?: (HeadersInit & (HeadersInit | CommonHeaders)) | undefined; ... 32 more ...; disableValidation?: boolean | undefined; }>(data_0: Prettify<...>, data_1?: FetchOptions | undefin...'.ts(2339) any ``` please help me!! ### What version of Better Auth are you using? "better-auth": "^1.1.21", ### Provide environment information ```bash window 11 ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { PrismaClient } from "@prisma/client"; import { oAuthProxy } from "better-auth/plugins"; import { nextCookies } from "better-auth/next-js"; const prisma = new PrismaClient(); export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: "postgresql", // or "mysql", "postgresql", ...etc }), account: { accountLinking: { enabled: true, trustedProviders: ["google"], }, }, socialProviders: { google: { clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || "", clientSecret: process.env.GOOGLE_CLIENT_SECRET || "", }, }, plugins: [oAuthProxy(), nextCookies()], session: { cookieCache: { enabled: true, maxAge: 30 * 24 * 60 * 60, secure: process.env.NODE_ENV === "production", sameSite: "lax", httpOnly: true, }, }, }); ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 08:02:47 -05:00
Author
Owner

@Tarek-Siddique-Nabil commented on GitHub (Feb 27, 2025):

check this in docs

social signon using google

I hope it will help to solve your problem

@Tarek-Siddique-Nabil commented on GitHub (Feb 27, 2025): ## check this in docs ### [social signon using google](https://www.better-auth.com/docs/authentication/google#sign-in-with-google) I hope it will help to solve your problem
Author
Owner

@Kinfe123 commented on GitHub (May 1, 2025):

is this issue still exists ?

@Kinfe123 commented on GitHub (May 1, 2025): is this issue still exists ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#749