Nekonyx / next-auth-steam

Steam authentication provider for next-auth
70 stars 18 forks source link

Use in App router with authOptions obj #15

Closed aychernov closed 7 months ago

aychernov commented 10 months ago

How to use SteamProvider without req?

I`m use something like this structure:

import NextAuth from "next-auth"
import {authOptions} from "@/lib/auth";

const handler = NextAuth(authOptions)

export {handler as GET, handler as POST}

And my authOptions:

export const authOptions: NextAuthOptions = {
    pages: {
        signIn: '/sign-in',
    },
    providers: [
        SteamProvider(req? ,{
            clientId: ...!,
            callbackUrl: ...!
        }),
}

Where i`m getting error about req and callbackUrl not found and define Some solutions or advice? image

Nekonyx commented 10 months ago

Hey, there's an example: https://github.com/Nekonyx/next-auth-steam/blob/956b70425be5cc3f395d91e4ee3f9952faecc7e4/examples/get-server-session/pages/api/auth/%5B...nextauth%5D.ts#L14

danfmn commented 10 months ago

Hey, there's an example:

https://github.com/Nekonyx/next-auth-steam/blob/956b70425be5cc3f395d91e4ee3f9952faecc7e4/examples/get-server-session/pages/api/auth/%5B...nextauth%5D.ts#L14

I'm looking to support the new routing here and I think that's what @aychernov is referring to as well? Do you have an example with this new structure? https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#accessing-request-object

jhammond2012 commented 10 months ago

I am getting the same image

I am guessing that I should downgrade next for now?

Nekonyx commented 10 months ago

Nope, you can type // @ts-expect-error for now. It seems Next.js or next-auth made some breaking changes in their API. Gonna take a look ASAP.

Nekonyx commented 7 months ago

Fixed