fix(useapplelogin): auth response

This commit is contained in:
Timothy Z. 2025-04-10 20:40:05 +03:00
parent 200d3a76d8
commit a1acb7423a
2 changed files with 8 additions and 6 deletions

View file

@ -9,11 +9,11 @@ type AppleLoginResponse = {
type AppleSignInResponse = { type AppleSignInResponse = {
authorization: { authorization: {
code: string;
id_token: string; id_token: string;
state: string;
}; };
user: string; authorizedData: {
userId: string;
};
email?: string; email?: string;
fullName?: { fullName?: {
firstName?: string; firstName?: string;
@ -52,8 +52,9 @@ const useAppleLogin = (): [() => Promise<AppleLoginResponse>, () => void] => {
.signIn() .signIn()
.then((response: AppleSignInResponse) => { .then((response: AppleSignInResponse) => {
if (response.authorization) { if (response.authorization) {
console.log('Apple Sign-In response:', response); // eslint-disable-line no-console
const email = response.email || ''; const email = response.email || '';
const sub = response.user; const sub = response.authorizedData.userId;
let name = ''; let name = '';
if (response.fullName) { if (response.fullName) {

View file

@ -38,9 +38,10 @@ declare global {
}) => void; }) => void;
signIn: () => Promise<{ signIn: () => Promise<{
authorization: { authorization: {
code: string;
id_token: string; id_token: string;
state: string; };
authorizedData: {
userId: string;
}; };
user: string; user: string;
email?: string; email?: string;