0

I am setting up next-auth for my app and trying to add login with email. I used mysql schemas from next-auth documentation and one of them is verification_requests:

CREATE TABLE verification_requests
  (
    id         INT NOT NULL AUTO_INCREMENT,
    identifier VARCHAR(255) NOT NULL,
    token      VARCHAR(255) NOT NULL,
    expires    TIMESTAMP(6) NOT NULL,
    created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
    updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
    PRIMARY KEY (id)
  );

When I try to login with email, it is giving following error: Field 'identifier' doesn't have a default value for following query:

INSERT INTO `verification_requests`(`id`, `identifier`, `token`, `expires`, `created_at`, `updated_at`) VALUES (DEFAULT, DEFAULT, '1db565ee611f2ed6c5ec0dacd79ac1fd3ffb860e1a249cfc7320b5e8381c0201', '2021-01-12 03:27:31.357', DEFAULT, DEFAULT)

I am getting this error because next-auth is trying to insert info verification_requests table but since the schema doesn't have default value for field identifier, it is throwing error. I couldn't find any thing mentioned about what kind of default value we need to declare in mysql schema for the Identifier field. Could anyone please help?

4

2 回答 2

0

Nextauth verify_request “标识符”是指从登录表单传递的用户电子邮件地址。该错误通常意味着您没有在 POST 请求正文中将 email 参数传递给 /api/auth/signin/email/ 。

于 2021-01-23T13:59:46.923 回答
0

您刚刚提到标识符字段不为空。为“标识符”列设置默认值。了解您的使用not null,这意味着您不应该将您的字段留空。

于 2021-01-11T04:29:40.383 回答