next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

LINE: error state is not specified when attempt to sign in, v5

Open Lodimup opened this issue 2 years ago • 3 comments

Provider type

Line

Environment

System: OS: Linux 6.4 Debian GNU/Linux 11 (bullseye) 11 (bullseye) CPU: (10) arm64 unknown Memory: 3.48 GB / 7.66 GB Container: Yes Shell: 5.1.4 - /bin/bash Binaries: Node: 20.9.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.8.1 - /usr/local/bin/npm pnpm: 8.10.2 - /usr/local/share/npm-global/bin/pnpm npmPackages: next: ^14.0.4 => 14.0.4 next-auth: ^5.0.0-beta.4 => 5.0.0-beta.4 react: ^18.2.0 => 18.2.0

Reproduction URL

https://github.com/Lodimup/next-auth-example/tree/main

Describe the issue

cannot sign in using Line provider line returns

http://localhost:3000/api/auth/callback/line?error=INVALID_REQUEST&error_description=%27state%27+is+not+specified.

How to reproduce

ENVs

AUTH_LINE_ID=xxx AUTH_LINE_SECRET=xxx This in V5 does not work

import NextAuth from "next-auth"; import Google from "@auth/core/providers/google"; import LINE from "@auth/core/providers/line";

export const { handlers: { GET, POST }, auth, } = NextAuth({ providers: [Google, LINE] }) While the same ID and Secret work fine in V4. Feeding ID and secret directly also does not work

export const { handlers: { GET, POST }, auth, } = NextAuth({ providers: [LINE({ clientId: LINE_CLIENT_ID, clientSecret: LINE_CLIENT_SECRET }) ...

Expected behavior

can sign in using line provider

Lodimup avatar Jan 09 '24 14:01 Lodimup

@Lodimup

I had a look at this and to get it working you need to add checks: ["state"] when adding the LINE provider.

   Line({
     clientId: process.env.LINE_CLIENT_ID,
     clientSecret: process.env.LINE_CLIENT_SECRET,
     checks: ["state"],
   })

dmacdermott avatar Mar 05 '24 01:03 dmacdermott

@Lodimup

I had a look at this and to get it working you need to add checks: ["state"] when adding the LINE provider.


   Line({

     clientId: process.env.LINE_CLIENT_ID,

     clientSecret: process.env.LINE_CLIENT_SECRET,

     checks: ["state"],

   })

Confirmed working solution

Lodimup avatar Mar 14 '24 04:03 Lodimup

Can confirm this fixes the Line provider login, Still curious what is the cause

undesicimo avatar Aug 09 '24 04:08 undesicimo