q 1: before, you used slim-skeleton latest version. created bunch of files on src folder named AuthController.php, AuthMiddleware.php, CalendarController.php, GoogleAuth.php. what should we do next?
q2: proccess of redirecting user to google to login, grant access to site app and rdirecting after the access authorize was done. and AuthController.php can successfully get data. 
q 3: how we saving the data after user authorize calenedar permission, and redirected to /auth/google/callback?code=xxxxxxx & etc
q 4: where should create profile.php / dashboard.php?
q 5: where should set the routes? in app/routes.php

code of files:
AuthController.php:
googleAuth = $googleAuth;
 }

 public function login(Request $request, Response $response): Response
 {
 $authUrl = $this->googleAuth->getAuthUrl();
 return $response->withHeader('Location', $authUrl)->withStatus(302);
 }

 public function callback(Request $request, Response $response): Response
 {
 $queryParams = $request->getQueryParams();
 // Check if the code parameter is present in the URL
 if (!isset($queryParams['code']) || empty($queryParams['code'])) {
 $response->withStatus(400)->getBody()->write('Missing authorization "code"');
 return $response;
 }

 $authCode = $queryParams['code'];
 $accessToken = $this->googleAuth->fetchAccessToken($authCode);
 

 // Check if the access token was retrieved successfully
 if (!$accessToken || !isset($accessToken['access\_token'])) {
 // Redirect the user to an error page or display an error message
 $response->withStatus(500)->getBody()->write('Failed to retrieve access token');
 return $response;
 }

 $userInfo = $this->googleAuth->getUserInfo($accessToken['access\_token']);

 // Save user information and access token in the session
 $\_SESSION['user'] = $userInfo;
 $\_SESSION['access\_token'] = $accessToken;

 // Redirect to the next step (requesting permission)
 $response->withHeader('Location', '/calendar/permission')->withStatus(302);
 return $response;
 }
} ?>

app/routes.php:
get("/", function (Request $request, Response $response) {
 $response->getBody()->write('Hello world!');
 return $response;
 });

 $app->group("/users", function (Group $group) {
 $group->get('', ListUsersAction::class);
 $group->get("/{id}", ViewUserAction::class);
 });
 
 $app->get('/auth/google', AuthController::class . ':login');
 $app->get('/auth/google/callback', AuthController::class . ':callback');
 // $app->get('/auth/google', [AuthController::class, 'login']);
 // $app->get('/auth/google/callback', [AuthController::class, 'callback']);

 $app->get('/calendar/permission', CalendarController::class . ':permission')->add(AuthMiddleware::class);
 $app->post('/calendar/event', CalendarController::class . ':createEvent')->add(AuthMiddleware::class);
}
};
?> 
AuthMiddleware.php:
getRouteParser();
 $url = $routeParser->urlFor('login');
 return (new Response())->withHeader('Location', $url)->withStatus(302);
 }

 // Continue to the next middleware/handler
 $response = $handler->handle($request);
 return $response;
 }
} ?>
CalendarController.php
setAccessToken($accessToken);
 $calendarService = new Google\_Service\_Calendar($googleClient);
 $calendarList = $calendarService->calendarList->listCalendarList();
 // Get the primary calendar ID
 $calendarId = $calendarList->getItems()[0]->getId();
 $authUrl = $googleAuth->getAuthUrl();
 return $response->getBody()->write("[Grant calendar access]({$authUrl})");
 }

 public function createEvent(Request $request, Response $response)
 {
 $eventDetails = $request->getParsedBody();

 $event = new Google\_Service\_Calendar\_Event([
 'summary' => $eventDetails['name'],
 'start' => [
 'dateTime' => $eventDetails['start\_time'],
 'timeZone' => 'UTC',
 ],
 'end' => [
 'dateTime' => $eventDetails['end\_time'],
 'timeZone' => 'UTC',
 ],
 ]);

 $googleClient = new Google\_Client();
 $googleClient->setAccessToken($\_SESSION['access\_token']);
 $calendarService = new Google\_Service\_Calendar($googleClient);
 $calendarService->events->insert($\_SESSION['user']['email'], $event);

 return $response->getBody()->write('Event created successfully!');
 }
}
?>
GoogleAuth.php
googleClient = new Google\_Client();
 $this->googleClient->setClientId($this->pre\_client\_id);
 $this->googleClient->setClientSecret($this->pre\_client\_secret);
 $this->googleClient->setRedirectUri($this->pre\_redirect\_uri);
 $this->googleClient->setScopes([
 Google\_Service\_Oauth2::USERINFO\_EMAIL,
 Google\_Service\_Oauth2::USERINFO\_PROFILE,
 'https://www.googleapis.com/auth/calendar'
 ]);
 }

 public function getAuthUrl()
 {
 return $this->googleClient->createAuthUrl();
 }

 public function fetchAccessToken($authCode)
 {
 return $this->googleClient->fetchAccessTokenWithAuthCode($authCode);
 }

 public function getUserInfo($accessToken)
 {
 $this->googleClient->setAccessToken($accessToken);

 $oauth2Service = new Google\_Service\_Oauth2($this->googleClient);
 return $oauth2Service->userinfo\_v2\_me->get();
 }
}?>
1: 이전에는 슬림 스켈레톤 최신 버전을 사용했습니다. AuthController.php, AuthMiddleware.php, CalendarController.php, GoogleAuth.php라는 이름의 파일을 src 폴더에 여러 개 만들었습니다.Q2: 사용자를 구글로 리디렉션하여 로그인하고 사이트 앱에 대한 액세스 권한을 부여하고 액세스 권한 부여가 완료된 후 리디렉션하는 프로세스. 그리고 AuthController.php가 데이터를 성공적으로 가져올 수 있습니다. Q 3: 사용자가 캘린더 권한을 승인하고 /auth/google/callback?code=xxxxxxx 등으로 리디렉션한 후 데이터를 저장하는 방법은 무엇인가요?Q 4: 프로필.php / 대시보드.php는 어디에 생성해야 하나요?Q 5: 경로를 어디에 설정해야 하나요? 앱/routes.php에서?파일 코드AuthController.php:googleAuth = $googleAuth; } 공개 함수 로그인(요청 $request, 응답 $response): Response { authUrl = $this->googleAuth->getAuthUrl(); return $response->withHeader('Location', $authUrl)->withStatus(302); } 공개 함수 콜백(요청 $request, 응답 $response): Response { queryParams = $request->getQueryParams(); // URL에 코드 파라미터가 있는지 확인합니다. if (!isset($queryParams['code']) || empty($queryParams['code'])) { response->withStatus(400)->getBody()->write('누락된 인증 "코드"'); return $response; } 인증 코드 = $쿼리 파라미터['코드']; accessToken = $this->googleAuth->fetchAccessToken($authCode);  // 액세스 토큰이 성공적으로 검색되었는지 확인합니다. if (!$accessToken || !isset($accessToken['access\_token'])) { // 사용자를 오류 페이지로 리디렉션하거나 오류 메시지를 표시합니다. response->withStatus(500)->getBody()->write('Failed to retrieve access token'); 응답을 반환합니다; } userInfo = $this->googleAuth->getUserInfo($accessToken['access\_token']); // 세션에 사용자 정보 및 액세스 토큰 저장 $\_SESSION['user'] = $userInfo; $\_SESSION['access\_token'] = $accessToken; // 다음 단계로 리디렉션(권한 요청) response->withHeader('Location', '/calendar/permission')->withStatus(302); 반환 $response; }} ?>app/routes.php:get("/", function (요청 $request, 응답 $response) { response->getBody()->write('Hello world!'); return $response; }); app->group("/users", function (Group $group) { $group->get('', ListUsersAction::class); $group->get("/{id}", ViewUserAction::class); });  app->get('/auth/google', AuthController::class . ':login'); app->get('/auth/google/callback', AuthController::class . ':callback'); // $app->get('/auth/google', [AuthController::class, 'login']); // $app->get('/auth/google/callback', [AuthController::class, 'callback']); app->get('/calendar/permission', CalendarController::class . ':permission')->add(AuthMiddleware::class); app->post('/calendar/event', CalendarController::class . ':createEvent')->add(AuthMiddleware::class);}};?> AuthMiddleware.php:getRouteParser(); url = $routeParser->urlFor('login'); return (new Response())->withHeader('Location', $url)->withStatus(302); } // 다음 미들웨어/핸들러로 계속 진행합니다. 응답 = $핸들러->핸들($요청); 반환 $response; }} ?>CalendarController.phpsetAccessToken($accessToken); 캘린더서비스 = 새 Google\_Service\_Calendar($googleClient); calendarList = $calendarService->calendarList->listCalendarList(); // 기본 캘린더 ID 가져오기 calendarId = $calendarList->getItems()[0]->getId(); authUrl = $googleAuth->getAuthUrl(); 반환 $response->getBody()->write("[캘린더 액세스 권한 부여]({$authUrl})"); } 공개 함수 createEvent(요청 $request, 응답 $response) { eventDetails = $request->getParsedBody(); event = new Google\_Service\_Calendar\_Event([ 'summary' => $eventDetails['name'], 'start' => [ 'dateTime' => $eventDetails['start\_time'], 'timeZone' => 'UTC', ], 'end' => [ 'dateTime' => $eventDetails['end\_time'], 'timeZone' => 'UTC', ], ]); 구글클라이언트 = 새로운 구글\_Client(); googleClient->setAccessToken($\_SESSION['access\_token']); calendarService = new Google\_Service\_Calendar($googleClient); calendarService->events->insert($\_SESSION['user']['email'], $event); 반환 $response->getBody()->write('이벤트가 성공적으로 생성되었습니다!'); }}?>GoogleAuth.phpgoogleClient = 새로운 Google\_Client(); this->googleClient->setClientId($this->pre\_client\_id); this->googleClient->setClientSecret($this->pre\_client\_secret); this->googleClient->setRedirectUri($this->pre\_redirect\_uri); this->googleClient->setScopes([[ Google\_Service\_Oauth2::USERINFO\_EMAIL, Google\_Service\_Oauth2::USERINFO\_PROFILE, 'https://www.googleapis.com/auth/calendar' ]); } 공개 함수 getAuthUrl() { return $this->googleClient->createAuthUrl(); } public function fetchAccessToken($authCode) { return $this->googleClient->fetchAccessTokenWithAuthCode($authCode); } public function getUserInfo($accessToken) { this->googleClient->setAccessToken($accessToken); oauth2Service = new Google\_Service\_Oauth2($this->googleClient); 반환 $oauth2Service->userinfo\_v2\_me->get(); }}?>