chore: google登录尝试修复
This commit is contained in:
parent
dfab6991e0
commit
dfca412ca6
|
@ -1,13 +1,9 @@
|
||||||
// "use server";
|
|
||||||
|
|
||||||
import { createClient } from "@/utils/supabase/server";
|
import { createClient } from "@/utils/supabase/server";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { insertUserProfile } from "@/utils/supabase/supabaseutils";
|
import { insertUserProfile } from "@/utils/supabase/supabaseutils";
|
||||||
|
|
||||||
// import { signOut } from "@/utils/supabase/serversignout";
|
|
||||||
|
|
||||||
export default async function AuthButton() {
|
export default async function AuthButton() {
|
||||||
const cookieStore = cookies();
|
const cookieStore = cookies();
|
||||||
const supabase = createClient(cookieStore);
|
const supabase = createClient(cookieStore);
|
||||||
|
@ -18,7 +14,7 @@ export default async function AuthButton() {
|
||||||
} = await supabase.auth.getUser();
|
} = await supabase.auth.getUser();
|
||||||
//profiles表 插入用户信息
|
//profiles表 插入用户信息
|
||||||
await insertUserProfile(data, supabase);
|
await insertUserProfile(data, supabase);
|
||||||
console.log("user", user);
|
console.log("1111 in AuthButton user:", user);
|
||||||
const signOut = async () => {
|
const signOut = async () => {
|
||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,13 @@ export function SignInWithProvider({ provider, redirectTo }) {
|
||||||
const supabase = createClient();
|
const supabase = createClient();
|
||||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||||
provider: provider,
|
provider: provider,
|
||||||
options: { redirectTo: redirectTo },
|
options: {
|
||||||
|
redirectTo: redirectTo,
|
||||||
|
queryParams: {
|
||||||
|
access_type: "offline",
|
||||||
|
prompt: "consent",
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user