我尝试通过firebase在next-auth.js中添加用户身份验证,我参考了文档中关于如何使用google作为提供商来实现登录系统的内容,即使我输入了正确的凭据,google仍然说应用程序的请求无效。
以下是我提出请求的方式:
import NextAuth from "next-auth";
import GoogleProvider from "next-auth/providers/google";
export const authOptions = {
// Configure one or more authentication providers
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
// ...add more providers here
],
};
export default NextAuth(authOptions);
1条答案
按热度按时间svmlkihl1#
只需在您的OAuth 2.0客户端ID配置中提及授权重定向URI(随附图片):
enter image description here
下一份授权文件还声明提及:授权重定向URI
对于生产:https://{您的域名}/API/auth/callback/google对于开发人员:网址:http://localhost:3000/api/auth/回调/谷歌
文档链接:https://next-auth.js.org/providers/google