From dd0058e4aa0a3f035a1524d540fc3acd99e24948 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Thu, 27 Mar 2025 11:10:04 +0800 Subject: [PATCH] fix(mobile): token header for social sign in --- apps/mobile/src/modules/login/social.tsx | 29 ++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/apps/mobile/src/modules/login/social.tsx b/apps/mobile/src/modules/login/social.tsx index 7bb7ea474..1cc431eee 100644 --- a/apps/mobile/src/modules/login/social.tsx +++ b/apps/mobile/src/modules/login/social.tsx @@ -6,6 +6,7 @@ import { AppleCuteFiIcon } from "@/src/icons/apple_cute_fi" import { GithubCuteFiIcon } from "@/src/icons/github_cute_fi" import { GoogleCuteFiIcon } from "@/src/icons/google_cute_fi" import { signIn, useAuthProviders } from "@/src/lib/auth" +import { getTokenHeaders } from "@/src/lib/token" const provider: Record< string, @@ -64,12 +65,17 @@ export function SocialLogin() { }) if (credential.identityToken) { - await signIn.social({ - provider: "apple", - idToken: { - token: credential.identityToken, + await signIn.social( + { + provider: "apple", + idToken: { + token: credential.identityToken, + }, }, - }) + { + headers: await getTokenHeaders(), + }, + ) } else { throw new Error("No identityToken.") } @@ -80,10 +86,15 @@ export function SocialLogin() { return } - signIn.social({ - provider: providerInfo.id as any, - callbackURL: "/", - }) + signIn.social( + { + provider: providerInfo.id as any, + callbackURL: "/", + }, + { + headers: await getTokenHeaders(), + }, + ) }} disabled={!data?.[providerInfo.id]} >