apple'da kullanııcının ismi kayıt edilmediği için 


import React, { useState } from "react";
import { Alert } from "react-native";
import {
  AppleError,
  appleAuth,
} from "@invertase/react-native-apple-authentication";
import CONFIG from "@/core/CONFIG";
import axios from "axios";
import IconButton from "@/components/SigninButtons/IconButton";
import { useRouter } from "expo-router";
import { useSession } from "@/core/session/AuthContext";

async function appleSignInRequest(): Promise<string | null | undefined> {
  try {
    const response = await appleAuth.performRequest({
      requestedOperation: appleAuth.Operation.LOGIN,
      requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL],
    });

    const credentialState = await appleAuth.getCredentialStateForUser(
      response.user,
    );

    if (credentialState === appleAuth.State.AUTHORIZED) {
      return response?.identityToken;
    }

    console.log("[Apple Sign In] Authentication failed. Original response: ", {
      response,
    });
  } catch (error) {
    console.log("[Apple Sign In] Request failed:", error);
  }
}

function AppleLoginButton() {
  const [isLoading, setIsLoading] = useState(false);
  const router = useRouter();
  const { signIn } = useSession();

  const handlePress = async () => {
    setIsLoading(true);
    try {
      const token = await appleSignInRequest();
      if (!token) {
        setIsLoading(false);
        return;
      }
      const postData = {
        access_token: token,
      };
      const axiosConfig = {
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json",
        },
      };

      const authToken = await axios.post(
        CONFIG.APPLE_SIGN_IN.WEB_CALLBACK_URL,
        postData,
        axiosConfig,
      );

      if (authToken?.data?.data) {
        await signIn(authToken?.data?.data); // signIn işlemini bekle
        router.replace("/");
      }
    } catch (error: AppleError | any) {
      if (error.code === appleAuth.Error.CANCELED) {
        console.log("[Apple Sign In] İşlem iptal edildi.");
      } else {
        console.error("Apple Sign In failed:", error);
        Alert.alert("Error", error?.response?.data?.message || "Server Error");
      }
    } finally {
      setIsLoading(false);
    }
  };

  if (!appleAuth.isSupported) {
    return null;
  }

  return (
    <IconButton
      onPress={handlePress}
      isLoading={isLoading}
      provider={CONFIG.SIGN_IN_METHOD.APPLE}
      variant="outline-apple"
    />
  );
}

AppleLoginButton.displayName = "AppleLoginButton";

export default AppleLoginButton;

<?php

declare(strict_types=1);

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use App\Jobs\UpdateUserAvatar;
use App\Models\User;
use App\Models\UserProvider;
use App\Traits\ApiResponses;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use Laravel\Socialite\Facades\Socialite;

final class SocialLoginController extends Controller
{
    use ApiResponses;

    public function callback(Request $request, $provider)
    {
        $validator = Validator::make($request->only('access_token'), [
            'access_token' => ['required', 'string'],
        ]);

        if ($validator->fails()) {
            return $this->error($validator->errors(), 400);
        }

        $accessToken = $request->input('access_token');
        try {

            $user = Socialite::driver($provider)->userFromToken($accessToken);

            $authUser = $this->findOrCreateUser($user, $provider);

            if (! $authUser) {
                return $this->error('User not found!', 404);
            }

            $token = $authUser->createToken($provider)->plainTextToken;

            return $this->success($token);
        } catch (Exception $exception) {
            return $this->globalError($exception->getMessage());
        }

    }

    private function findOrCreateUser($socialUser, $provider)
    {
        if ($authUser = UserProvider::where('provider_id', $socialUser->getId())->first()) {
            return User::findOrFail($authUser->user->id);
        }

        if ($authUser = User::where('email', $socialUser->getEmail())->first()) {
            UserProvider::create([
                'user_id' => $authUser->id,
                'provider_id' => $socialUser->getId(),
                'provider' => $provider,
                'provider_token' => $socialUser->token ?? null,
                'provider_refresh_token' => $socialUser->refreshToken ?? null,
            ]);

            return $authUser;
        }

        $name = $socialUser->getName() ?? $socialUser->getNickname() ?? 'User '.Str::random(4);

        $email = $socialUser->getEmail();

        if ($email === '') {
            return $this->error('Social Login does not have email!', 400);
        }

        $user = User::create([
            'name' => $provider === 'google' ? $name : ,
            'email' => $email,
            'password' => null,
        ]);

        UserProvider::create([
            'user_id' => $user->id,
            'provider_id' => $socialUser->getId(),
            'provider' => $provider,
            'provider_token' => $socialUser->token ?? null,
            'provider_refresh_token' => $socialUser->refreshToken ?? null,
        ]);

        if (! $user->is_uploaded_avatar) {
            UpdateUserAvatar::dispatch(
                user: $user,
                file: $socialUser->getAvatar() ?? null,
            );
        }

        return $user;
    }
}

Hello,


Thank you for your resubmission. Upon further review, we identified additional issues that need your attention. See below for more information.


If you have any questions, we are here to help. Reply to this message in App Store Connect and let us know.



Review Environment


Submission ID: 4db5ce-4e8f-9544-de1b60527e61

Review date: November 17, 2024

Version reviewed: 1.0


Guideline 4.0 - Design


Your app offers Sign in with Apple as a login option but does not follow the design and user experience requirements for Sign in with Apple. Specifically:


- Your app requires users to provide their name and/or email address after using Sign in with Apple. This information is already provided by the Authentication Services framework.



These requirements provide the consistent experience users expect when using Sign In with Apple to authenticate or log in to an account.


Next Steps


Please revise the Sign in with Apple experience in your app to address the issues we identified above.


Resources


- To learn more about App Store design requirements, see App Review Guideline 4 - Design.

- For an overview of design and formatting recommendations for Sign in with Apple, review the Human Interface Guidelines.


Support


- Reply to this message in your preferred language if you need assistance. If you need additional support, use the Contact Us module.

- Consult with fellow developers and Apple engineers on the Apple Developer Forums.

- Provide feedback on this message and your review experience by completing a short survey.



The In App Purchase products have been returned to you and will need to be resubmitted with a revised binary. They are currently in a state of “Developer Action Needed”. 


We look forward to reviewing your app once these issues have been addressed and the new build has been received and queued for review.



Please be sure to resubmit any required, previously rejected, or unapproved In App Purchase products along with the revised binary.


Best regards,


App Review